Skip to content Skip to sidebar Skip to footer

Webpack 4.1.1 -> Configuration.module Has An Unknown Property 'loaders'.

I just updated webpack to 4.1.1 and when I try to run it I get the following error: Invalid configuration object. Webpack has been initialised using a configuration object that

Solution 1:

Looked at an example loader for webpack 4.1.1:

https://webpack.js.org/loaders/raw-loader/

All I had to do was rename loaders to rules.

module: {
    rules: [
        { test: /\.tsx?$/, loader: ['ts-loader'] },
        { test: /\.css$/, loader: "style-loader!css-loader" },
        {
            test: /\.scss$/, use: [{
                loader: "style-loader" // creates style nodes from JS strings
            }, {
                loader: "css-loader" // translates CSS into CommonJS
            }, {
                loader: "sass-loader" // compiles Sass to CSS
            }]
        },
        { test: /\.(otf|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/, loader: 'file-loader?name=./Scripts/dist/[name].[ext]' }
    ]
}

Post a Comment for "Webpack 4.1.1 -> Configuration.module Has An Unknown Property 'loaders'."