Loader Webpack "You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file."

Viewed 419

I have a problem, I miss some loader when adding background url in scss ... do you have any idea?

ERROR in ./element/about/LANDING/LANDING/tło_podstawowe/tło.png 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 (Source code omitted for this binary file) @ ./element/scss/main.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./element/scss/main.scss) 5:0-92 7:73-102 @ ./element/scss/main.scss @ ./element/src/app.js

const path = require("path");
const entryPath = "element";

module.exports = {
  entry: `./${entryPath}/src/app.js`,
  output: {
    filename: "out.js",
    path: path.resolve(__dirname, `${entryPath}/build`)
  },
  devServer: {
    contentBase: path.join(__dirname, `${entryPath}`),
    publicPath: "/build/",
    compress: true,
    port: 3001,
    historyApiFallback: true
  },
  module: {
    rules: [
      {
        test: /\.js$|jsx/,
        exclude: /node_modules/,
        loader: "babel-loader",
      },
      {
        test: /\.s[ac]ss$/i,
        use: [
          // Creates `style` nodes from JS strings
          "style-loader",
          // Translates CSS into CommonJS
          "css-loader",
          // Compiles Sass to CSS
          "sass-loader",
        ],
      }
    ]
  }
};

1 Answers

Change your public path to a relative path instead of an absolute ‘./build/‘

Related