-
Notifications
You must be signed in to change notification settings - Fork 94
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
PostCSS block with SASS and sourceMap #116
Comments
Hmm, works on my machine... Could you please provide the stack trace, the complete config and the package versions you use? |
Sass file used for import: $icon-font-path: '~bootstrap-sass/assets/fonts/bootstrap/';
@import '~bootstrap-sass/assets/stylesheets/bootstrap';
body.foobarbaz {
background: gray;
} Versions:
Config: sourceMaps(),
sass({relative_assets: true, sourceMap: true}),
extractText('[name].css', 'text/x-sass'), // change to x-less if less is used |
Seems to be an issue with the webpack sass-loader: webpack-contrib/sass-loader#285 Upgrading to Another possible fix: Try setting the webpack context path (as suggested in the sass-loader issue). |
I've added the following and it fixed the issue: addPlugins([
new webpack.LoaderOptionsPlugin({
options: {
context: '/'
}
}),
]) |
It's even shorter if you use - addPlugins([
- new webpack.LoaderOptionsPlugin({
- options: {
- context: '/'
- }
- }),
- ])
+ setContext('/') The question is now: How do we handle this issue in webpack-blocks? ... :-/ Might bump the |
|
Ahh, really? Shit. Cannot find anything about that in the official upgrade docs :-/ Do you know any document stating what they changed about the context? |
https://webpack.js.org/guides/migrating/#loaderoptionsplugin-context it's down there ))) in the doc you just sent. |
Thanks for the link! But it doesn't state that the Did they drop the |
Context is still there, not dropped, at least to my knowledge... but those are two different things. |
Any resolution? I suggest to add a plugin automatically if it's Webpack 2 and sourceMap. |
@kirill-konshin Created a bugfix branch. Could you please try this fix? b170df7 |
Works fine. Btw, |
Strange that I just cannot reproduce it locally, though... |
https://github.com/kirill-konshin/react-ssr-playground/tree/master/webpack-blocks you can use my playground, it has the less block from #114 where I checked the behavior too. |
Still works if I use your playground and comment-out the |
(Used |
It's because this plugin is now in lessBlock.js ))) |
Ahhh... Here we go 🙈 |
But I still cannot get the sass/extract-text end-to-end test to fail without the fix. Cannot see the major difference to your playground code 🙃 |
I have pushed an update to playground, it consistently fails on |
I commented out everything unrelated and narrowed to these lines:
So seems probably not SASS/LESS should have additional plugin, but postcss :) |
Oh my god... 😅 But really seems like it. Also found another issue comment pointing in a similar direction. Now I'm asking myself: Is the @ai Do you know anything about this weird issue? |
Probably postcss block is a better place for the fix since it is the root cause. |
Is it the root cause? I am not sure, since both the |
Never saw this error, sorry 😞 |
Well... Sass + source map (w/o postcss) works OK, so it's kinda self contained. If we add postcss to the mix, then it fails. Btw, if you add plugin to SASS, you also have to add it to LESS, so if both are used together (crazy) then plugin will be added twice. So postcss seems to be a better and more semantic location... |
@ai No problem :) @kirill-konshin Good point! 👍 |
Woohoo! Thanks! |
Adding
sass({sourceMap: true})
produces error:The text was updated successfully, but these errors were encountered: