一个webpack入门的大坑

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

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理