学习 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",