Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass meta.apply doesn't work with vite #15443

Closed
7 tasks done
OleksandrSymonov opened this issue Dec 27, 2023 · 3 comments
Closed
7 tasks done

Sass meta.apply doesn't work with vite #15443

OleksandrSymonov opened this issue Dec 27, 2023 · 3 comments

Comments

@OleksandrSymonov
Copy link

Describe the bug

I'm trying to use new feature meta.apply($mixin) it's work fine with plain build scss via
./node_modules/.bin/sass ./src/mixins.scss output.css but doesn't work via run vite or via vite build

mixins.scss looks like

@use "sass:map";
@use "sass:meta";

@mixin someMixin() {
  background: blue;
}

.blue {
  @include meta.apply(meta.get-mixin("someMixin"));
}

output

.blue {
  background: red;
  color: blue;
}

It's works fine in scss playground.

https://sass-lang.com/playground/#eJwzNHQoLU5VUCpOLC62yk0sULLmQhZILUkEinA55GZWZOYpFOfnpvqCWBqaCtVcCgpJicnZ6UX5pXkpVgpJOaWp1ly1XFx6IBZY2iEzLzmnNCVVAWSMXmJBQU6lBpiZnlqiCzZRQwlupJKmJlA7AP6ULtQ=

Reproduction

https://stackblitz.com/edit/vitejs-vite-bvdyzt?file=src%2FApp.vue

Steps to reproduce

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.10.5 - /usr/local/bin/pnpm
  npmPackages:
    @vitejs/plugin-vue: ^4.5.2 => 4.6.0 
    vite: ^5.0.8 => 5.0.10

Used Package Manager

npm

Logs

No response

Validations

Copy link

stackblitz bot commented Dec 27, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@bluwy
Copy link
Member

bluwy commented Dec 28, 2023

Do you mean the Error: Bad state: Can't access __parent outside of a module. error? Seems like it's caused by Vite using the deprecated sass render method. I'm not sure if this is intentional, but I'll report this upstream to check.

If it's intentional, the progress to check when we migrate to the new compileString api is #7116. So I'll close this for now in favour of the two things above.

For future reference, here's a simpler Vite repro: https://stackblitz.com/edit/vitejs-vite-pnh9jp?file=main.js,style.scss&terminal=dev

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2023
@OleksandrSymonov
Copy link
Author

Thanks for response. Yeah, this is it.
I found answer in your attached links.

I have just change sass to sass-embedded
#6734

It works for me like a charm

@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants