vue-cli: vue-cli and sass-loader@8 incompatibility
Version
4.0.0-rc.0
Reproduction link
https://github.com/jacekkarczmarczyk/vue-cli-sass-loader-repro
Environment info
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-4700HQ CPU @ 2.40GHz
Binaries:
Node: 12.6.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.17.3 - C:\Users\Jacek\AppData\Roaming\npm\yarn.CMD
npm: 6.10.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.0.0
@vue/babel-plugin-transform-vue-jsx: 1.0.0
@vue/babel-preset-app: 3.11.0
@vue/babel-preset-jsx: 1.1.0
@vue/babel-sugar-functional-vue: 1.0.0
@vue/babel-sugar-inject-h: 1.0.0
@vue/babel-sugar-v-model: 1.0.0
@vue/babel-sugar-v-on: 1.1.0
@vue/cli-overlay: 3.11.0
@vue/cli-plugin-babel: ^3.2.0 => 3.11.0
@vue/cli-plugin-eslint: ^3.2.0 => 3.11.0
@vue/cli-plugin-typescript: ^3.2.0 => 3.11.0
@vue/cli-service: ^3.2.0 => 3.11.0
@vue/cli-shared-utils: 3.11.0
@vue/component-compiler-utils: 3.0.0
@vue/eslint-config-standard: ^4.0.0 => 4.0.0
@vue/eslint-config-typescript: ^4.0.0 => 4.0.0
@vue/preload-webpack-plugin: 1.1.1
@vue/test-utils: ^1.0.0-beta.20 => 1.0.0-beta.29
@vue/web-component-wrapper: 1.2.0
eslint-plugin-vue: ^5.0.0 => 5.2.3 (4.7.1)
eslint-plugin-vuetify: ^1.0.0-beta.1 => 1.0.0-beta.3
typescript: ~3.5.0 => 3.5.3
vue: ^2.5.21 => 2.6.10
vue-eslint-parser: 5.0.0 (2.0.3)
vue-hot-reload-api: 2.3.3
vue-loader: 15.7.1
vue-style-loader: 4.1.2
vue-template-compiler: ^2.5.21 => 2.6.10
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
@vue/cli: Not Found
Steps to reproduce
Clone the repo and run yarn && yarn build
What is expected?
Successfull build
What is actually happening?
$ vue-cli-service build
- Building for production...
Starting type checking service...
Using 1 worker with 2048MB memory limit
ERROR Failed to compile with 1 errors22:27:09
error in ./src/App.vue?vue&type=style&index=0&lang=sass&
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema.
- options has an unknown property 'indentedSyntax'. These properties are valid:
object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
at validate (C:\cygwin64\home\Jacek\karpc\repro\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:49:11)
at Object.loader (C:\cygwin64\home\Jacek\karpc\repro\node_modules\sass-loader\dist\index.js:36:28)
at C:\cygwin64\home\Jacek\karpc\repro\node_modules\webpack\lib\NormalModule.js:313:20
at C:\cygwin64\home\Jacek\karpc\repro\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at C:\cygwin64\home\Jacek\karpc\repro\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at runSyncOrAsync (C:\cygwin64\home\Jacek\karpc\repro\node_modules\loader-runner\lib\LoaderRunner.js:143:3)
at iterateNormalLoaders (C:\cygwin64\home\Jacek\karpc\repro\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at iterateNormalLoaders (C:\cygwin64\home\Jacek\karpc\repro\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at C:\cygwin64\home\Jacek\karpc\repro\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at context.callback (C:\cygwin64\home\Jacek\karpc\repro\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at C:\cygwin64\home\Jacek\karpc\repro\node_modules\cache-loader\dist\index.js:118:7
at C:\cygwin64\home\Jacek\karpc\repro\node_modules\graceful-fs\graceful-fs.js:57:14
at FSReqCallback.oncomplete (fs.js:153:23)
@ ./src/App.vue?vue&type=style&index=0&lang=sass& 1:0-480 1:496-499 1:501-978 1:501-978
@ ./src/App.vue
@ ./src/main.ts
@ multi ./src/main.ts
Error goes off when you remove <style> section from App.vue
It also worked when I removed
defaultSassLoaderOptions.fiber = require('fibers')
in https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/config/css.js#L21 and changed
indentedSyntax: true
to
sassOptions: {
indentedSyntax: true
}
in https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/config/css.js#L181
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 38
- Comments: 37 (6 by maintainers)
Commits related to this issue
- vuetify 설치중 vuetify 설치중 sassloader 문제 발생 https://github.com/vuejs/vue-cli/issues/4513 2일전에 올라온 vue-cli와 sass-loader의 비호환성 문제인듯, App.vue에 <style></style> 태그를 넣지 않으면 발생한다고하는데, 태그를 추가했으나 문제가 해결되지 않음 er... — committed to professor-lol/professor-lol by jyami-kim 5 years ago
- sass-loader 8系は動作しないため7系に変更 https://github.com/vuejs/vue-cli/issues/4513 — committed to dozensofdars/vue-tutorial by dozensofdars 5 years ago
- Update sass-loader Sass loader on npm install automatically updates to latest version, and there's a known issue at [1]. Fix this by downgrading sass-loader. Links: 1. https://github.com/vuejs/vue-c... — committed to fredlawl/h4g-api-jobs by fredlawl 4 years ago
- Update sass-loader (#9) Sass loader on npm install automatically updates to latest version, and there's a known issue at [1]. Fix this by downgrading sass-loader. Links: 1. https://github.com/vu... — committed to sgfdevs/h4g-api-jobs by fredlawl 4 years ago
- Downgraded sass-loader to fix a compatibility issue with 8.x. See issue https://github.com/vuejs/vue-cli/issues/4513 — committed to rpitv/glimpse-ui by robere2 3 years ago
- Downgraded sass-loader to fix a compatibility issue with 8.x. See issue https://github.com/vuejs/vue-cli/issues/4513 — committed to rpitv/glimpse by robere2 3 years ago
- Downgraded sass-loader to fix a compatibility issue with 8.x. See issue https://github.com/vuejs/vue-cli/issues/4513 — committed to rpitv/glimpse by robere2 3 years ago
- Downgraded sass-loader to fix a compatibility issue with 8.x. See issue https://github.com/vuejs/vue-cli/issues/4513 — committed to rpitv/glimpse by robere2 3 years ago
Replace data with “prependData”.
I had issue with ‘data’ in sassLoader. Apparently they renamed it to ‘prependData’ and did some changes, so you would have to look into their documentation or read the output. I use Node, not Yarn.
fixed by changing prependData -> additionalData
For the record, we install
^7.0.0explicitly, so this won’t affect users unless they actively choose to do a major version bump of this dependency.@jacquesmatthieu have you tried following the description in the OP? If you find problems along the way, ask more specifically.
Or simply use sass-loader v7, which is the version we installed for you initially, and which is the version we support right now.
I’ve got the same problem what’s the solution ? I can’t build Vuetify module in my project …
@SavkaTaras I can’t share the repo sorry. @LinusBorg I’ve got downgrade to sass-loader and it works. Thx you !
In my case, I had to modify my export in vue.config.js (configureWebpack.css.loaderOptions.scss.data -> configureWebpack.css.loaderOptions.scss.prependData). Here’s the complete file for context:
You’re absolutely right, but maybe it’s worth to make 4.0 compatible with new sass loader? Since the stable version is not released yet, so it’s the last moment to update it as I guess otherwise we will have to wait for vue-cli 5? Of course this seems to be breaking change which you may not want to add since the RC version is already released
I think the actual actionable issue here is that following these instructions:
https://cli.vuejs.org/guide/css.html#pre-processors
Causes 8.x to be installed.
Downgrading to 7.x works fine for me.
In which file? webpack.config.js?
But I thought it was merged?
I solved creating the “webpack.config.js” .
module.exports = { module: { rules : [ { test: /\.vue$/, loader: 'vue-loader', options: { loaders: { scss: 'vue-style-loader!css-loader!sass-loader', sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax' }, preLoaders: { js: '/caminho/personalizado/para/carregador' }, postLoaders: { html: 'babel-loader' }, excludedPreLoaders: /(eslint-loader)/ } } ] } }Same problem here. My output of the log looks the same.
@av1m install
sass@1.32.8(this exact version)The fix for this is to create a vue.config.js file or use the one already created if you can find it and then fill it with the below. Note that this fix is for folks using the vue cli
css: { loaderOptions: {
}
in your main.scss, import all your mixins and variable files.
If you don’t want to follow this approach, you could make prependData a function, loop through an array of all your ‘@import’ statements and return each of the files out of the for loop block. Like below:
css: { loaderOptions: {
} you’ll no longer need a single man.scss file
So, according to the migration guide, you’re supposed to “take a look at the v8 release and upgrade to the latest version” but it’s not actually supported… That’s super odd.
It’s supported in 4.0.0-rc.3 and 3.12
running
vue serveaftervue create fresh:Note: following suggestions for solutions in this repo, I also added
fibersand downgradedsass-loaderfrom 8 to 7. But the same build error persists.package.json: