我的用webpack4配置react的时候安装less依赖,遇到问题
这是webpack.config.js
use: [ { loader: MiniCssExtractPlugin.loader, options: { publicPath: '../' } }, { loader: "css-loader"}, { loader: "style-loader" }, { loader: "postcss-loader", options: { plugins: () => [autoprefixer()] } } ]
不知道为啥报错,找了很久也没找到解决办法
ERROR in ./src/pages/home/home.less (./node_modules/css-loader/dist/cjs.js!./node_modules/style-loader!./node_modules/postcss-loader/src??ref--4-3!./src/pages/home/home.less) Module build failed (from ./node_modules/css-loader/dist/cjs.js): CssSyntaxError (2:1) Unknown word 1 | > 2 | var content = require("!!../../../node_modules/postcss-loader/src/index.js??ref--4-3!./home.less"); | ^ 3 | 4 | if(typeof content === 'string') content = [[module.id, content, '']];
但是当我把
{ loader: "style-loader" }, { loader: "postcss-loader", options: { plugins: () => [autoprefixer()] } }
注释掉了有不报错了
吃鸡游戏
慕田峪7331174
相关分类