I
I
Ingvar Von Bjork2020-07-11 18:39:42
webpack
Ingvar Von Bjork, 2020-07-11 18:39:42

How to import css into webpack?

I decided to learn Webpack, but I stumbled almost at the very beginning - I could not import CSS.
Installed the style-loader and css-loader packages.
In index.js entered In webpack.condig.js:import './sass/main.css';

module.exports = {
    module: {
        rules: [
            {
                test: /\.сss$/,
                use: ['style-loader', 'css-loader']
            }
        ]
    }
};


When compiled, it produces:
ERROR in ./src/sass/main.css 1:5
Module parse failed: Unexpected token (1:5)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> body {
|   background: pink; }
|
 @ ./src/index.js 2:0-25

What have I done wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question