Module parse failed: Unexpected character '@' (1:0)

Paul

I'm a really beginner in Webpack and React. I want to use some npm (carousel multi react), but I can't. It's something wrong with my webpack.config. Unfortunetly I can't resolve this on my own, and I saw some similiar topics, but it doesn't working for me... or I just don't know how to implement solutions in my file.

ERROR in ./node_modules/react-multi-carousel/lib/styles.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

const path = require("path");

const Html = require('html-webpack-plugin');

module.exports = {
  entry: [
    "whatwg-fetch",
    "./js/index.js",
  ],
  output: { 
    filename: "js/out.js",
    path: path.resolve(__dirname, "build")
  },
  devServer: {
    port: 3001,
  },
  module: {
    rules: [

      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
        }
      },

      {
        test: /\.scss$/,
        use: [
          'style-loader',
          'css-loader',
          {
            loader: "postcss-loader",
            options: {
              plugins: () => [
                require("autoprefixer")()
              ],
            },
          },
          'sass-loader',
        ]
      },

      {
        test: /\.(jpg|jpeg|gif|png)$/,
        use: {
          loader: 'file-loader',
          options: {
            name: '[name].[ext]',
            publicPath: 'images',
            outputPath: 'images',
          }
        }
      },

      {
        test: /\.(eot|ttf|woff|woff2)$/,
        use: {
          loader: 'file-loader',
          options: {
            name: '[name].[ext]',
            publicPath: 'fonts',
            outputPath: 'fonts',
          }
        }
      },
    ]
  },

  plugins: [
    new Html({
        filename: 'index.html',
        template: './index.html',
    })
  ]
};
Prabhat Mishra

Try adding the below json to the rules array.

  {
    test: /\.(sass|less|css)$/,
    loaders: ['style-loader', 'css-loader', 'less-loader']
  }

Also install the required npm modules for the above loaders, or else you can also try with adding test: /\.(sass|css)$/, to your current setup.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Next JS: Module parse failed: Unexpected character '�' (1:0)

Module parse failed: Unexpected character '@'

Module parse failed: Unexpected character '' (1:0) when adding ttf to my stylesheet

Module parse failed: Unexpected character '@' (1:0) with Storybook 6.1.11, Webpack 5.11.0, React 17.0.1

webpack 4 - Module parse failed: Unexpected character '�' (1:0) on simple JS file

Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type

Module parse failed: Unexpected character '@' (1:0) - You may need an appropriate loader to handle this file type

NextJS Module parse failed: Unexpected character '@' (7:0)

Cant import video file Module parse failed: Unexpected character ' ' (1:0) React.js Next.js

fsevents causes Module parse failed: Unexpected character '�'

Webpack 4 - Module parse failed: Unexpected character '@'

Nuxt - Module parse failed: Unexpected character '#'

webpack module parse failed Unexpected character '@'

React Module parse failed: Unexpected character '@'

Module parse failed: *.ts Unexpected character '@'

Webpack 4 - Module parse failed: Unexpected character ' '

Module parse failed: error: semantic/dist/semantic.min.css Unexpected character '@' (11:0)

React JS: ERROR in index.css 1:0 (Module parse failed: Unexpected token (1:0))

DateTime::__construct(): Failed to parse time string (16/07/2020) at position 0 (1): Unexpected character

Webpack 4 error - Module parse failed: Unexpected character '@'

electron-webpack-react error "Module parse failed: Unexpected character '@'"

ssh2: Module parse failed: Unexpected character '�'

Module parse failed: Unexpected character '�' in an image with vuetify loader

Module parse failed: Unexpected token (1:0) vue.js vuex store

Module parse failed: Unexpected token

./node_modules/node-pty/build/Release/pty.node Module parse failed: Unexpected character ''

Module parse failed: Unexpected character '@'. Getting this error for component with Angular 6 CLI

Module parse failed: Unexpected character '@' while running yarn run storybook with vue-loader

"Failed to parse content to map" "Unexpected character '}'