webpack - 处理未知参数

时间:2017-05-30 22:49:38

标签: webpack

我在安装了webpack 1.x的旧计算机上使用webpack --process -p来处理我的jsx文件。在我的新网站上,我安装了当前指向2.6.1的webpack,现在它告诉我--process是一个未知的参数。

如何处理此问题?

这是我的webpack.config.js文件:

var IS_DEV = false; // change to false if building production files

var webpack = require('webpack');
var path = require("path");

var _pluginsDev = [
        new webpack.ProvidePlugin({
            'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch',
            moment: 'moment',
            ps: 'perfect-scrollbar'
        }),

];
var _pluginsProd = [
        new webpack.ProvidePlugin({
            'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch',
            moment: 'moment',
            ps: 'perfect-scrollbar'
        }),
        new webpack.DefinePlugin({ // Minimizer, removing multiple occurances of imports et.c
            'process.env': {
                'NODE_ENV': JSON.stringify('production')
            }
        }),
        new webpack.optimize.UglifyJsPlugin({
            minimize: true,
            compress: true,
            output: { comments: false }
        })
];


var _devtool = IS_DEV ? 'eval' : 'cheap-module-source-map';
var _plugins = IS_DEV ? _pluginsDev : _pluginsProd;
var _fileName = IS_DEV ? "./build/[name]-bundle.js" : "./dist/[name]-bundle.js";

var _bundles = {
    module1: './components/module1/module1.jsx',
    module2: './components/module2/index.jsx'
};


// Export for Project List
module.exports = {
    devtool: _devtool,
    entry: _bundles,
    plugins: _plugins,
    output: {
        path: path.resolve(__dirname, "wwwroot"),
        publicPath: "/",
        filename: _fileName

    },
    module: {
        loaders: [
          {
              test: /\.jsx?$/,
              exclude: /(node_modules|bower_components)/,
              loader: 'babel',
              query: {
                  presets: ['es2015', 'stage-2', 'react']
              }
          }
        ]
    },
    resolve: {
        extensions: ['', '.js', '.jsx']
    }
};

0 个答案:

没有答案