After webpack starts webpack-dev-server, it indicates that the parsing of css module failed, but I have installed css-loader, to solve the problem.

Screenshot always failed to upload, damn it!

just describe it and ask God for help! (novice to webpack, I really don"t understand)

my webpack.config.js file
.

module: {
        rules: [
            {
                test: /\.js$/,
                loader: "babel-loader",
                include: [resolve("src"), resolve("node_modules/webpack-dev-server/client")],
                options: {
                    "presets": ["env"]
                }
            },
            {
                test: /\.css$/,
                use: ["style-loader", "css-loader"]
            },
            {
                test: /\.(png|svg|jpe?g|gif)$/,
                loader: "url-loader",
                options: {
                      limit: 10000
                  }
            },
            {
                test: /\.(woff2?|eot|ttf|otf)$/,
                loader: "url-loader",
                options: {
                      limit: 10000
                }
            },
            {
                test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/,
                loader: "url-loader",
                options: {
                      limit: 10000
                }
            }
        ]
    }

then, when I start webpack-dev-server (when I compile to the line import". / main.css" when I command: npm run start), I keep reporting an error that prompts me to error in. / src/main.css Module parse failed: Unexpected token (1:0)

I checked a lot of information and said that I should install babel-loader, but I still reported an error after I installed it. Both css-loader and style-loader have acridine. Why do I keep prompting me to fail in parsing?


you can try to replace import'. / main.css' with require ('loader loaderloaderloaderloaderloaderloaderloaderloaderloaderloaderloaderloaderloaderloaderloaderloaderloadermaker.) < CSSS > the reason is that you need to specify a loader to handle this type of file, because although you have installed loader, you do not specify in the file which loader to use to deal with this type of file.
it is not clear why other materials can be used without adding css-loader.


I also encountered the same problem. Did the landlord solve it

?
Menu