简体   繁体   中英

How to turn off webpack linting

I'm getting the following error:

SyntaxError: arguments is a reserved word in strict mode

when trying to do:

console.log(arguments);

How do I turn off webpack linting? My config looks like so:

var plugins = [
    new webpack.LoaderOptionsPlugin({
        debug: true
    }),
    plugins.push(new webpack.DefinePlugin({
        'process.env': {
            NODE_ENV: JSON.stringify('production')
        }
    }))
    plugins.push(new webpack.optimize.UglifyJsPlugin())
];

webpack({
    entry: entry.path,
    output: {
        filename: output['file name'],
        path: output.path
    },
    resolve: {
        modules: module.paths,
        extensions: ['.js', '.jsx']
    },

    module: {
        rules: [{
            test: /.jsx?$/,
            exclude: /node_modules/,
            use: [{
                loader: 'babel-loader',
                options: {
                    babelrc: false,
                    presets: ['es2015', 'react']
                }
            }]
        }]
    },
    resolveLoader: {
        modules: loader.paths
    },
    plugins: plugins,
    stats: {
        colors: true,
        errorDetails: true,
        modules: true,
        modulesSort: "field",
        reasons: true,
    }
}, function(err, stats) {
    if (err) {
        require('log')(err);
        return;
    }

    const info = stats.toJson();
    if (stats.hasErrors()) {
        require('log')(info.errors);
    }
    else {
        require('log')(options.launcher + " compiled")
    }

    if (stats.hasWarnings()) {
        require('log')(info.warnings)
    }
});

.... Words so that I can post this questions with out stackoverflow giving me the error that my question is mostly code.... ...

This is an SyntaxError , which means you have a broken code that can't be compiled. It's the same error you get when you forget to type half of a curly brackets.

It's not a lint problem (for code styles).

Most likely you mistakenly used reserved word arguments as a variable name. Rename it to something else.

Run code bellow you can see you still get an error without webpack.

 "use strict"; var arguments = 1; console.log(arguments) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM