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
[BUG] Requested content ".css" but built .scss. #2967
Comments
Its could be caused by this :#3029 |
Thanks for the quick fix! |
Your welcome but I'm not sure if its really the cause of this issue. |
That's a good point. I applied the change locally but that didn't seem to fix the issue. I played with the snowpack code a bit and what worked for me is to force the code to enter this if logic here and default the undefined result to an empty string. This is a very hacky change but just want to illustrate the logical path if (result === undefined || typeof result === 'string' || Buffer.isBuffer(result)) {
const mainOutputExt = step.resolve.output[0];
return {
[mainOutputExt]: {
code: result || '',
},
};
} |
I'm running into the same error message above. Is anyone working on resolving this? Even if I downgrade to snowpack @3.0.0 (which used to work) it still throws that error. |
I applied the change by @cain-wang to the built js diff --git a/node_modules/snowpack/lib/index.original.js b/node_modules/snowpack/lib/index.js
index df38480..a0dff21 100644
--- a/node_modules/snowpack/lib/index.original.js
+++ b/node_modules/snowpack/lib/index.js
@@ -54132,11 +54132,11 @@ async function runPipelineLoadStep(srcPath, { isDev, isSSR, isPackage, isHmrEnab
});
logger.logger.debug(`✔ load() success [${debugPath}]`, { name: step.name });
config.validatePluginLoadResult(step, result);
- if (typeof result === 'string' || Buffer.isBuffer(result)) {
+ if (result === undefined || typeof result === 'string' || Buffer.isBuffer(result)) {
const mainOutputExt = step.resolve.output[0];
return {
[mainOutputExt]: {
- code: result,
+ code: result||'',
},
};
} and now it works fine. |
I face this issue, with a The file has to contain a CSS output to workaround this issue. For example, this file will trigger the problem: $main-color: #000;
html {
} Whereas this one will not: $main-color: #000;
html {
font-size: inherit;
} From my understanding of the patch and the behaviour of the workaround, a |
I have the same problem. Empty mixins/variables files fails while building. Is there any solution? |
@themukhiddin one work around I have was to add a random css style to the mixin file. // adds a placeholder style to workaround snowpack build failure
// https://github.com/snowpackjs/snowpack/issues/2967
.snowpack-build-placeholder {
display: none;
} |
@cain-wang i had the same problem. this |
This is indeed a current limitation of Snowpack. What should be the expected behavior here? If you’re importing something into Sass via However, when you’re importing a Sass file into Snowpack, you’re telling Snowpack “build a |
I just realized in #3079 that it is a bug with scanning |
I’m actually having a little trouble reproducing this on the latest version of Snowpack. Can anyone still reproduce on |
@drwpow I believe that the actual problem is that the plugin API isn't enough to handle sass so you actually do have some exception for sass even in the snowpack core which actually make no sense for me, As for me you rather have sass fully supported on core or have a better plugin API to handle it properly (Fit with SASS API requirement) ,For me I see that having sass handled by default is a not a bad option as you already done that with TS . Why the plugin API is not enough you may ask, Cause to be able to take fully advantage of sass API you have to provide an input and output directory and then SASS API will take care of everything |
Bug Report Quick Checklist
Describe the bug
Seeing the following error running
snowpack build
with latest snowpack (3.1.1).By tracing the code, it is possible related to this change:
Simplify. cleanup, enhance snowpack internals
To Reproduce
In my project, there's a pure scss mixin file. Inside runPipelineLoadStep(), it produces undefined result at this line. The undefined
result
value caused an ext mismatch in runPipelineLoadStep's return value.So instead of
It produces
This mismatch caused verifyRequestFromBuild() to fail as it was looking for a
.css
built content.Adding a random CSS style inside the mixin file could bypass the issue.
Expected behavior
Snowpack build should support scss mixins.
The text was updated successfully, but these errors were encountered: