webpack构建错误:未定义Set

时间:2017-03-28 17:53:19

标签: webpack webpack-dev-server webpack-2 webpack-style-loader html-webpack-plugin

我在特定计算机上遇到Webpack错误。在另一台机器上我没有得到任何错误&建设是成功的。在这两台机器上我们都使用Webpack 2.2.1版本。

错误:

Set is not defined 
at Compiler.<anonymous> (/home/../meCommerce-fed/fed-mecommerce/node_modules/copy-webpack-plugin/dist/index.js:83:33)
at Compiler.next (/home/../meCommerce-fed/fed-mecommerce/node_modules/webpack/node_modules/tapable/lib/Tapable.js:69:14)
at /home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/index.js:189:9
at PassThroughHandlerContext.finallyHandler (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/finally.js:56:23)
at PassThroughHandlerContext.tryCatcher (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/async.js:143:10)
at Async.drainQueues (/home/../meCommerce-fed/fed-mecommerce/node_modules/html-webpack-plugin/node_modules/bluebird/js/release/async.js:17:14)
at process._tickCallback (node.js:415:13)

它说Set没有在copy-webpack-plugin上定义,这有点奇怪。

Webpack配置:

注意:这不是整个配置文件。

var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var CopyWebpackPlugin = require('copy-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var ProvidePlugin = require('webpack/lib/ProvidePlugin');

module.exports = {
  debug: true,
  entry: {
    vendor_angular: ["angular","angular-ui-router","angular-sanitize"],
    bundle: ['./src/app.js'],
  },
  // entry: ['babel-polyfill', './src/app.js'],
  output: {
    path: path.join(__dirname, 'public'),
    filename: '[name].js'
  },
  devServer: {
    // This is required for webpack-dev-server. The path should
    // be an absolute path to your build destination.
    outputPath: path.join(__dirname, 'public')
  },
  plugins: [
    new CopyWebpackPlugin([
      { from: 'src/**/*.js', to: __dirname + '/public' },
      { from: 'src/**/*.png', to: __dirname + '/public' },
      { from: 'src/**/*.svg', to: __dirname + '/public' },
      { from: 'src/**/*.json', to: __dirname + '/public' },
      { from: 'src/**/*.jpg', to: __dirname + '/public' },
      { from: 'src/**/*.mp4', to: __dirname + '/public' },
      { from: 'src/**/*.gif', to: __dirname + '/public' },
      { from: 'src/**/*.wav', to: __dirname + '/public' }
    ]),
    new CleanWebpackPlugin(['public'], {
      root: path.resolve(__dirname),
      verbose: true,
      dry: true
    }),
      ],
  module: {
   },

  devtool: 'source-map'
};

有没有人遇到过类似的错误。我应该如何追踪导致构建失败的原因。

0 个答案:

没有答案