簡體   English   中英

如何關閉Webpack棉絨

[英]How to turn off webpack linting

我收到以下錯誤:

SyntaxError: arguments is a reserved word in strict mode

嘗試做時:

console.log(arguments);

如何關閉webpack棉絨? 我的配置如下所示:

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)
    }
});

....這樣的話使我可以在不使用stackoverflow的情況下發布此問題,這給我一個錯誤,即我的問題主要是代碼。

這是一個SyntaxError ,這意味着您的代碼損壞,無法編譯。 當您忘記鍵入大括號的一半時,會遇到相同的錯誤。

這不是一個皮棉問題(對於代碼樣式)。

您很可能錯誤地將保留字arguments用作變量名。 將其重命名為其他名稱。

在下面運行代碼,您可以看到沒有webpack仍然出現錯誤。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM