A
A
Alexander Bondarenko2021-08-20 13:18:16
React
Alexander Bondarenko, 2021-08-20 13:18:16

How to fix error in webpack config?

Error loading styles

ERROR in ./node_modules/slick-carousel/slick/slick-theme.css 1:0
Module parse failed: Unexpected character '@' (1:0)
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
> @charset 'UTF-8';
| /* Slider */
| .slick-loading .slick-list
 @ ./src/Components/Blog/Blog.js 178:0-46
 @ ./src/App.js 148:0-42 320:52-56
 @ ./src/index.js 4:0-24 7:161-164


webpack:
const path = require('path');

module.exports = {
    entry: {
        app: './src/index.js'
    },
    watch: true,
    devtool: 'source-map',
    output: {
        filename: '[name].bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        rules: [{
                test: /\.js$/,
                exclude: /node_modules/,
                use: ['babel-loader']
            },
            {
                test: /\.js|.jsx$/,
                exclude: /node_modules/,
                use: "babel-loader",
            },
            {
                test: /\.css$/,
                exclude: /node_modules/,
                use: ["style-loader", "css-loader"],
            },
            {
                test: /\.svg$/,
                use: [{
                        loader: "babel-loader"
                    },
                    {
                        loader: "react-svg-loader",
                        options: {
                            jsx: true // true outputs JSX tags
                        }
                    }
                ]
            },
            {
                        test: /\.scss$/,
                        include: [
                            path.resolve(__dirname, 'src', 'sass')
                        ],
                        use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
                    }

        ]
    },
    resolve: {
        extensions: [
            '.js', '.jsx', '.scss'
        ]
    }
}

{
  "name": "garagedoors",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "webpack": "webpack"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.15.0",
    "@babel/preset-env": "^7.15.0",
    "@babel/preset-react": "^7.14.5",
    "babel-loader": "^8.2.2",
    "css-loader": "^6.2.0",
    "file-loader": "^6.2.0",
    "node-sass": "^6.0.1",
    "postcss-loader": "^3.0.0",
    "webpack": "^5.51.1",
    "webpack-cli": "^4.8.0"
  },
  "dependencies": {
    "@zeit/next-css": "^1.0.1",
    "autoprefixer": "^9.0.0",
    "jquery": "^3.6.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-remove-scroll-bar": "^2.2.0",
    "react-router-dom": "^5.2.0",
    "react-slick": "^0.28.1",
    "react-svg-loader": "^3.0.3",
    "sass-loader": "^12.1.0",
    "slick-carousel": "^1.8.1",
    "style-loader": "^3.2.1",
    "url-loader": "^4.1.1"
  }
}

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