MonKey_526
2017-08-19 03:51
明明所有loader都下载到局部环境了:
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.1",
"babel-preset-latest": "^6.24.1",
"css-loader": "^0.28.5",
"html-loader": "^0.5.1",
"html-webpack-plugin": "^2.30.1",
"less-loader": "^4.0.5",
"node-sass": "^4.5.3",
"postcss-loader": "^2.0.6",
"style-loader": "^0.18.2",
"webpack": "^3.5.5"
打包时还是疯狂报错:
ERROR in ./src/components/layer/layer.less
Module parse failed: C:\Users\Haopc\Desktop\webpack-demo-sourceFile\src\components\layer\layer.less Unexpected token (2:0)
You may need an appropriate loader to handle this file type.
ERROR in ./src/css/common.css
Module parse failed: C:\Users\Haopc\Desktop\webpack-demo-sourceFile\src\css\common.css Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.
本来是html报错,我把webpack.config.js删了重新写了一个,就变成这样了,弄到现在凌晨4点心态崩了。有老哥帮帮我吗?
需要装一个less ,npm 命令安装:npm install less --save-dev ,安装完成之后在安装less-loader,命令:npm install less-loader --save-dev
webpack.config.js俩面有这个吗:
{
test: /\.less$/,
use: ['style-loader', 'css-loader', 'postcss-loader', 'less-loader']
},
报错信息上不是有吗?你的less文件打包失败了,应该是你的less没装吧,装一下less应该就就好了
webpack深入与实战
86561 学习 · 721 问题
相似问题