Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack config has an unknown property 'preLoaders'

I'm learning webpack from scratch. I've learned how to link javascript files with require. I'm bundling and minifying my js files and i'm listening for changes with watch. I'm setting up loaders to convert my sass files to css. But when I try to setup a linting process with jshint-loader, i'm running into issues.

    module: { preLoaders: [         {             test: /\.js$/, // include .js files             exclude: /node_modules/, // exclude any and all files in the node_modules folder             loader: "jshint-loader"         } ],  loaders: [   {     test: /\.scss$/,     loader: 'style-loader!css-loader!sass-loader'   },   {     test: /\.js$/,     loader: 'babel-loader',     exclude: /node_modules$/,     query: {       presets: ['es2015']     }   } ], 

}

Here is the error

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.module has an unknown property 'preLoaders'. These properties are valid: object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, loaders?, noParse?, rules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? } Options affecting the normal modules (NormalModuleFactory).

like image 276
bakerTX Avatar asked Feb 27 '17 00:02

bakerTX


1 Answers

You are apparently trying to use examples for webpack v1 with webpack v2. Straight from the changelog:

  module: { -   preLoaders: [ +   rules: [       {         test: /\.js$/, +       enforce: "pre",         loader: "eslint-loader"       }     ]   } 
like image 121
Ivan Avatar answered Sep 19 '22 16:09

Ivan