37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import type { UserConfigExport } from "@tarojs/cli";
|
|
export default {
|
|
mini: {
|
|
webpackChain: (chain, webpack) => {
|
|
chain.merge({
|
|
plugin: {
|
|
install: {
|
|
plugin: require('terser-webpack-plugin'),
|
|
args: [
|
|
{
|
|
terserOptions: {
|
|
compress: true, // 默认使用terser压缩
|
|
// mangle: false,
|
|
keep_classnames: true, // 不改变class名称
|
|
keep_fnames: true, // 不改变函数名称
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
})
|
|
}
|
|
},
|
|
h5: {
|
|
/**
|
|
* WebpackChain 插件配置
|
|
* @docs https://github.com/neutrinojs/webpack-chain
|
|
*/
|
|
// webpackChain (chain) {
|
|
// /**
|
|
// * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
|
|
// * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
|
|
// */
|
|
|
|
}
|
|
} satisfies UserConfigExport<'webpack5'>
|