升级webpack时报的错

来源:1-6 (如果您初学,建议您先跟着课程版本走,项目完成后再升级)补充Webpack4.29升级(2)

慕神0494925

2019-10-16

跟着视频执行完:npm install vue-loader@14.2.4 -D
再启动项目会报如下的错:
ERROR in ./client/layout/header.vue (./node_modules/css-loader/dist/cjs.js?{“sourceMap”:true,“localIdentName”:"[path]-[name]-[hash:base64:5]",“importLoaders”:1,“camelCase”:true,“modules”:true}!./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 initialised using an options object that does not match the API schema.

  • options has an unknown property ‘camelCase’. These properties are valid:
    object { url?, import?, modules?, sourceMap?, importLoaders?, localsConvention?, onlyLocals? }
    at validate (E:\programs\vue\pack\node_modules\css-loader\node_modules\schema-utils\dist\validate.js:50:11)
    at Object.loader (E:\programs\vue\pack\node_modules\css-loader\dist\index.js:34: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,“camelCase”:true,“modules”:true}!./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-448 14:3-18:5 15:22-456
    @ ./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
    @ multi (webpack)-dev-server/client?http://0.0.0.0:8000 (webpack)/hot/dev-server.js ./client/client-entry.js
写回答

1回答

Jokcy

2019-10-20

css-loader也发了新版本,所以也需要更新配置了,你可以退回上个大版本,或者更新配置,配置可以看这里:https://github.com/webpack-contrib/css-loader

1
2
富尔牛
回复
慕神0494925
请问你的问题解决了吗?我也遇到了同样的问题,更新配置后依然没有解决
2019-11-23
共2条回复

Vue核心技术 Vue+Vue-Router+Vuex+SSR实战精讲

深入讲解Vue核心技术,展示Vue应用开发中的各种问题和解决方案

3168 学习 · 853 问题

查看课程