vue.config.js 729 B

123456789101112131415161718192021
  1. const path = require('path')
  2. // const CopyWebpackPlugin = require('copy-webpack-plugin')
  3. const resolve = dir => path.join(__dirname, dir)
  4. module.exports = {
  5. transpileDependencies: ['@dcloudio/uni-ui'],
  6. chainWebpack: config => {
  7. config.resolve.alias.set('@/', resolve('src'))
  8. // 发行或运行时启用了压缩时会生效
  9. config.optimization.minimizer('terser').tap((args) => {
  10. const compress = args[0].terserOptions.compress
  11. // 非 App 平台移除 console 代码(包含所有 console 方法,如 log,debug,info...)
  12. // compress.drop_console = true
  13. compress.pure_funcs = [
  14. '__f__' // App 平台 vue 移除日志代码
  15. ]
  16. return args
  17. })
  18. }
  19. }