-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Vue Config won't accept independent loaderOptions for both scss
and sass
.
#4116
Comments
I imagine changing line above to;
might be a viable solution? |
https://discordapp.com/channels/340160225338195969/361889521815519233/598165002691543040 module.exports = {
css: {
loaderOptions: {
sass: {
data: `@import "~@/sass/_variables.scss";`,
},
},
},
chainWebpack: config => {
["vue-modules", "vue", "normal-modules", "normal"].forEach((match) => {
config.module.rule('sass').oneOf(match).use('sass-loader')
.tap(opt => Object.assign(opt, { data: `@import '~@/sass/_variables.scss'` }))
})
}
} |
Hi @KaelWD, I implemented this chainWebpack config changing rule('sass') for rule('scss') and importing my main.scss at the end and it worked with my Vuetify 2 app. This problem with scss/sass was because of using scss and importing a sass inside of it? (in my main.scss). I'd like to get a better understanding of this solution. Thank you! |
Invalid in .scss files: @import "~@/sass/_variables.scss" // Error: missing semicolon Invalid in .sass files: @import "~@/sass/_variables.scss"; // Error: unexpected ; |
@sodatea this still happens for me on |
@vkaracic In 4.0.0-beta.3 we have added a module.exports = {
css: {
loaderOptions: {
sass: {
data: `@import "~@/sass/_variables.sass"`,
},
scss: {
data: `@import "~@/sass/_variables.scss";`,
}
}
}
} |
This feature has also been landed in v3 with today's release of v3.11.0 |
Make sure to update the @vue/cli-service
|
@rayfoss Have you updated the |
i got the same error "Semicolons arent allowed in the indented syntax"
up to date.. My vue scss files import config:
any one know my problem and have maybe a solution for me? |
My solution was to update @vue/cli-service to 3.11.0 and modify the vue loader config
|
@rayfoss - thanks for your fast answer! this is my full vue loader config:
The filenames have the same names "_variables.scss ... " edit: i dont have sass files.. only scss |
@kdamiani is it possible that one of your modules is using sass? My |
@rayfoss i have sass installed.. vers 1.17.4 u mean this? my _variables.scss is not an empty file..
after this i get the error message:
maybe this helps? |
@rayfoss damn.. yes.. |
Hah? So I need to add an empty sass file into the assets and add them to my conf file? I didn't have to do this before. I used node-sass, now I'm using sass and I got this error too: // Imports
^
Semicolons aren't allowed in the indented syntax.
╷
1 │ @import '@/assets/base.scss';
│ ^
╵
stdin 1:29 root stylesheet
in C:\Projekte\myproject\node_modules\vuetify\src\components\VAlert\VAlert.sass (line 1, column 29) |
Works for me, thanks |
Note, because of the way scoped loaders work in Vue 2... you CANNOT USE @use and expect variables to work normally... wait till Vue 3 for that or scope with randomized ID's. Currently, prepended @use variables are not reachable by scoped component styles... which means you have to use @import in prepended sass data, which prevents you from using @use anywhere. |
Version
3.8.2
Reproduction link
https://github.com/cadriel/vue-cli-sass-scss-issue
Environment info
Steps to reproduce
What is expected?
You should be able to have both
sass
andscss
styles in a project concurrently, along with the ability to define loaderConfig for each.What is actually happening?
The project fails to compile because the vue config references a
sass
formatted file - yet the HelloWorld component hasscss
styles.Because the loaderConfig applies to both
scss
andsass
an error is thrown.A solution might be to add distinct loaderConfig for both
scss
andsass
. You can see that these configurations are not distinct currently here;vue-cli/packages/@vue/cli-service/lib/config/css.js
Line 168 in 1ff22d2
This is primarily an issue when you're depending on external projects that say use
sass
formatted styles, but your own project usesscss
. I'm looking at you Vuetify 2.0. :)The text was updated successfully, but these errors were encountered: