Closed nojaf closed 3 years ago
According to @snowpack/plugin-sass
’ README, you have to install the plugin and add it to your Snowpack config to enable it, like so:
- plugins: ['@snowpack/plugin-react-refresh', '@snowpack/plugin-dotenv'],
+ plugins: ['@snowpack/plugin-react-refresh', '@snowpack/plugin-dotenv', '@snowpack/plugin-sass'],
If I do this, I’m able to load .sass
files just fine.
Let me know if I missed your issue, or if there’s something else that’s causing problems!
Edit: ah, sorry—I missed the “only variables” part. You’re right that does result in an error.
I’m not sure, though, if this is an error on Snowpack’s fault? In Sass, what is an empty file supposed to produce? I believe the intended effect is to @use
or @import
within Sass to import these variables, right? I believe that is still working as expected for Snowpack, but let me know if there’s a scenario where you want an empty .css
file in the build output.
There is no scenario where I explicitly want that empty file. I import a file that only contains variables. https://github.com/fsprojects/fantomas-tools/blob/f51c04dc93cf095f9b363d42a2e9f4ab9a913cab/src/client/src/styles/fantomas.sass#L1
And that leads to problems with snowpack.
Ah this is a bug in our @import
scanning. I see. We’ll definitely need a fix for this.
I’ll consider this issue a duplicate of https://github.com/snowpackjs/snowpack/issues/2967 and we can track resolution there. In the meantime, a temporary workaround is to use @use
if you’re able to, which is what Sass encourages people use now instead of @import
(but I know not every setup can switch just yet; it’ll be a slow migration but Sass @import
will be deprecated eventually)
@nojaf I tried your repo, and on the latest version of Snowpack, I’m no longer seeing the issue if I remove the “blink” hack (I had to fix some broken imports to do so, like src/client/debug.js
). Can you confirm?
Yes, I can confirm. The problem seems to be resolved.
Bug Report Quick Checklist
Describe the bug
My snowpack build is failing, there is a problem with react-refresh and sass plugin interfering.
To Reproduce
We can't fix bugs that we can't see for ourselves. Issues often need to be closed if this section is skipped.
npm init snowpack-app --template @snowpack/app-template-react
Variables.sass looks like
Expected behavior
A clear and concise description of what you expected to happen.
Anything else?
A workaround is to add some sass code that will produce css.