webpack升级过程中localIdentName配置报错
来源:1-6 (如果您初学,建议您先跟着课程版本走,项目完成后再升级)补充Webpack4.29升级(2)
chenG丨Yu
2020-05-15
ERROR in ./client/layout/header.vue (./node_modules/css-loader/dist/cjs.js?{“sourceMap”:true,“localIdentName”:"[path]-[name]-[hash:base64:5]",“importLoaders”:1,“modules”:true,“localsConvention”:“camelCase”}!./node_modules/vue-loader/lib/style-compiler?{“optionsId”:“0”,“vue”:true,“scoped”:false,“sourceMap”:true}!./node_modules/stylus-loader!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./client/layout/header.vue)
Module build failed (from ./node_modules/css-loader/dist/cjs.js):
ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property ‘localIdentName’. These properties are valid:
object { url?, import?, modules?, sourceMap?, importLoaders?, localsConvention?, onlyLocals?, esModule? }
at validate (F:\VScode\vue-ssr-problem\node_modules\schema-utils\dist\validate.js:88:11)
at Object.loader (F:\VScode\vue-ssr-problem\node_modules\css-loader\dist\index.js:36:28)
@ ./client/layout/header.vue (./node_modules/vue-loader/node_modules/vue-style-loader!./node_modules/css-loader/dist/cjs.js?{“sourceMap”:true,“localIdentName”:"[path]-[name]-[hash:base64:5]",“importLoaders”:1,“modules”:true,“localsConvention”:“camelCase”}!./node_modules/vue-loader/lib/style-compiler?{“optionsId”:“0”,“vue”:true,“scoped”:false,“sourceMap”:true}!./node_modules/stylus-loader!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./client/layout/header.vue) 4:14-464 14:3-18:5 15:22-472
@ ./client/layout/header.vue
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./client/app.vue
@ ./client/app.vue
@ ./client/create-app.js
@ ./client/client-entry.js
3回答
-
qq_钟离紫灵_0
2021-03-11
css rules里面
// modules: true,
// localIdentName: '[local]_[hash:base64:8]'改成
modules: {
auto: true,
localIdentName: '[path][name]__[local]--[hash:base64:5]',
}00 -
慕雪1162788
2020-05-29
+1,搞了好久依然无法解决这个报错
012020-06-01 -
Jokcy
2020-05-20
新版的css-loader,不支持localIdentName这个配置,报错信息里面写的很明白了,可以看一下最新的css-loader
022020-08-26
相似问题