学习webpack打包css的时候,遇到了这个错误:

ERROR in ./src/index.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this f
ile. See https://webpack.js.org/concepts#loaders
> .hello{
|   color: red;
| }
 @ ./src/index.js 1:0-21

明明没有任何的错误,却就是报错了,loader的顺序也没错。
最后发现,是没有加载config。

解答

把package.json的build改为

"build": "webpack --config webpack.config.js",

yunyuyuan
42 声望2 粉丝