A big pit for webpack entry

Posted Jun 6, 20201 min read

When learning webpack packaging css , I encountered this error:

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

Obviously there are no errors, but the error is reported, and the order of the loader is correct.
Finally found that config is not loaded.

Answer

Change the build of package.json to

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