ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 优化编译速度 安装 ``` npm install --save-dev thread-loader cache-loader taro-plugin-compiler-optimization ``` 使用 ``` // config/index.js config = { // ... plugins: ['taro-plugin-compiler-optimization'], } ``` ## 解决包体积过大无法进行预览的问题 ``` // config/dev.js module.exports = { 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, // 不改变函数名称 }, }, ], }, }, }) }, }, } ``` ## 依赖预加载 ``` /** config/index.js */ const config = { compiler: { type: 'webpack5', // 仅 webpack5 支持依赖预编译配置 prebundle: { enable: true, }, }, } ```