如何修改vue-cli3预设的terser-webpack-plugin?

现有一个基于vue-cli3和webpack4的vue2项目,我使用vue-cli-service inspect命令导出webpack配置后,minimizer部分如代码所示:

minimizer: [

{

options: {

test: /\.m?js(\?.*)?$/i,

chunkFilter: () => true,

warningsFilter: () => true,

extractComments: false,

sourceMap: false,

cache: true,

cacheKeys: defaultCacheKeys => defaultCacheKeys,

parallel: true,

include: undefined,

exclude: undefined,

minify: undefined,

terserOptions: {

compress: {

arrows: false,

collapse_vars: false,

comparisons: false,

computed_props: false,

hoist_funs: false,

hoist_props: false,

hoist_vars: false,

inline: false,

loops: false,

negate_iife: false,

properties: false,

reduce_funcs: false,

reduce_vars: false,

switches: false,

toplevel: false,

typeofs: false,

booleans: true,

if_return: true,

sequences: true,

unused: true,

conditionals: true,

dead_code: true,

evaluate: true

},

mangle: {

safari10: true

}

}

}

}

]

可以看到,里面并没有new TerserPlugin(),但是里面确实又有terserOption,请问下大佬们这是不是vue-cli内置了terser插件,如果是内置插件的话为什么不会被inspect导出来呢,而且如果是这种没有new TerserPlugin()的情况,我该如何修改这个插件的配置或者删除这个插件以更换别的插件呢?


回答:

在build文件夹的webpack.prod.conf.js文件中修改

以上是 如何修改vue-cli3预设的terser-webpack-plugin? 的全部内容, 来源链接: utcz.com/p/934950.html

回到顶部