-
-
Notifications
You must be signed in to change notification settings - Fork 150
Use rollup to transform styles before applying scope to scoped styles #300
Comments
@znck can you shed some light on this issue, and any potential workarounds? I get the exact same I also don't fully understand why the title was changed to include "before applying scope to scoped styles", as OP does not used |
After a bit of digging I've learned that importing Have a read: https://github.com/webpack-contrib/sass-loader/blob/master/README.md#resolving-import-at-rules For your example, @khalyomede, you should be able to pass For my case, since I have an existing application with a codebase full of the |
@khalyomede a quicker fix would be to run |
I found a fix that worked great for me: rollup.config.js
|
Hi, i have to admit i just quickly browsed over this issue and i hope i understood the problem right - however just a quick note on how i was able to import files from node modules - namely by altering the config for rollup-plugin-vue the following way:
might this be what you are looking for? |
Just tried this, but found out this does not work for CSS imports. If the import ends on ".css", it will simply not pass the file through the I have slightly improved your
I am not sure if EDIT: It does seem to still be applying the |
Posting in case it's helpful to other's in the future, but I used a combination of other responses above which provides a more simple approach then replacing aliases... only note is that documentation on this could probably be better. I did have to define data in 2 different places to get it to work. I also use const globImporter = require('node-sass-glob-importer'); data: {
scss: () => '@import "library";'
},
style: {
preprocessOptions: {
scss: {
importer: globImporter(),
includePaths: [
path.resolve(__dirname, '../node_modules/breakpoint-sass/stylesheets/'),
path.resolve(__dirname, '../en-style/src/scss'),
path.resolve(__dirname, '../en-style/src'),
],
data: '@import "library";'
}
}
} |
Is there any documentation of what options are available in |
@plummer-flex that's within the but I think that just takes options similar to the Vue CLI CSS Furthermore, I believe all the css loaders had to make slight changes to their options for webpack 5 so I think you want to be using the options pre-webpack 5. I think for sass-loader version 10 is still compatible with webpack 4. |
Version
5.0.0
Reproduction link
None (this is an issue in the build step).
Steps to reproduce
Compile an SFC that requires sass files from node modules.
What is expected?
To find the sass files correctly from node_modules.
What is actually happening?
Sass files are not found.
I use the plugin to compile an SFC that import a sass file from node_modules. Here is my rollup.config.js:
And here is my SFC (producing the error):
And here is the error:
Does vue template compiler tries to load using CSS3
@import
instead of finding fromnode_modules
?I read those 2 issues:
But it seems not working either (as I do not have the exact code the others persons used I post my full config here and hope someone can answer this tricky question I am struggling with).
The text was updated successfully, but these errors were encountered: