Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack 2 syntax for preloader (enforce: 'pre') return error #142

Closed
olivier-o opened this issue Nov 25, 2016 · 3 comments
Closed

webpack 2 syntax for preloader (enforce: 'pre') return error #142

olivier-o opened this issue Nov 25, 2016 · 3 comments

Comments

@olivier-o
Copy link

using the webpack 2 syntax for preloader (enforce: 'pre') ...

loaders: [
      {
        test: /\.jsx?$/,
        loader: 'eslint-loader?{fix: true}',
        exclude: /node_modules/,
        enforce: 'pre'
      },

return "enforce" is not allowed error message.
Will be glad to work on a fix, if someone can point me to where this validation is happening

@hinok
Copy link

hinok commented Dec 1, 2016

Have the same problem. In the readme is written that

Note that as of webpack v2 (currently in beta), configuration validation is baked in.

So for webpack 2, there is no reason to use webpack-validator? I found something in the webpack repository

Could someone explain it clearly?


It looks that webpack 2 has config validation, after removing webpack-validator I got this very nice written error

/Users/dk/Desktop/Dev/code-splitting/node_modules/webpack/lib/webpack.js:17
                throw new WebpackOptionsValidationError(webpackOptionsValidationErrors);
                ^
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'eslint'. These properties are valid:
   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
   For typos: please correct them.
   For loader options: webpack 2 no longer allows custom properties in configuration.
     Loaders should be updated to allow passing options via loader options in module.rules.
     Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
     plugins: [
       new webpack.LoaderOptionsPlugin({
         // test: /\.xxx$/, // may apply this only for some modules
         options: {
           eslint: ...
         }
       })
     ]
    at webpack (/Users/dk/Desktop/Dev/code-splitting/node_modules/webpack/lib/webpack.js:17:9)
    at Object.<anonymous> (/Users/dk/Desktop/Dev/code-splitting/webpack/webpack-dev-server.js:23:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

So nice!

@biswassuman23
Copy link

Same issue what is the solution?

@kentcdodds
Copy link
Collaborator

The solution is to not use this package with Webpack 2 anymore. It's no longer necessary. Please see the notice in the README. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants