如何忽略vue.config.js上Vue公司CLI 3插件

问题描述 投票:-1回答:1

我使用Vue公司CLI3,并希望忽略moment.js用的WebPack插件。这是规则,但它vue.confing.js给出了一个错误,不管我怎么改变它。

  plugins: [
        new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
    ], 
vue.js vue-cli
1个回答
2
投票

你似乎是试图利用deprecated constructor。试试这个,不要忘记导入webpack到脚本...

const webpack = require('webpack')

module.exports = {
  configureWebpack: {
    plugins: [
      new webpack.IgnorePlugin({
        resourceRegExp: /^\.\/locale$/,
        contextRegExp: /moment$/
      })
    ]
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.