Cannot resolve Babel plugins with Babel loader and Webpack

1.5k Views Asked by At

I have the following Webpack config:

{
    resolveLoader: {
        root: path.join(__dirname, 'node_modules')
    },
    module: {
        loaders: [
            {
                test: /\.es6?$/,
                exclude: /node_modules/,
                loader: 'babel',
                query: {
                    sourceMap: true,
                    presets: [
                        'es2015'
                    ],
                    plugins: [
                        'transform-class-properties'
                    ]
                }
            }
        ]
    }
}

My project structure:

.
+-- deploy
|   +-- node_modules
|   +-- Gulpfile.js
+-- es6
|   +-- Source files

The error I get:

ERROR in ../es6/src.es6
Module build failed: ReferenceError: Unknown plugin "transform-class-properties" specified in "base" at 0, attempted to resolve relative to "[ABSOLUTE_PATH]/es6"

Seems like resolveLoader doesn't work for some reason.

Tried to remove the transform-class-properties plugin and I'll get the same error for the es2015 preset.

Any suggestion?

1

There are 1 best solutions below

1
On

enter code hereReplace loaders x Rules:

 module: {
       loaders: [
            {
           }
        ]
     }