const path = require('path')

module.exports = {
  env: {
    NODE_ENV: '"pre"',
  },
  outputRoot: 'dist',
  defineConstants: {
    CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"',
    CURRENT_CAP_HTML_TO_IMAGE_BASE_URL: '"https://pre.zzfzyc.com"',
    CURRENT_PAY_H5_CODE_URL: '"https://pre.zzfzyc.com/cashier"',
    CURRENT_IMG_CND_Prefix: '"https://test.cdn.zzfzyc.com"',
  },
  mini: {
    optimizeMainPackage: {
      enable: true,
    },
    webpackChain: (chain, webpack) => {
      chain.merge({
        plugin: {
          install: {
            plugin: require('terser-webpack-plugin'),
            args: [
              {
                terserOptions: {
                  // compress: true, // 默认使用terser压缩
                  compress: {
                    drop_console: true, // 去掉打印
                  }, // 默认使用terser压缩
                  // mangle: false,
                  keep_classnames: true, // 不改变class名称
                  keep_fnames: true, // 不改变函数名称
                },
              },
            ],
          },
        },
      })
    },
  },
  h5: {},
  alias: {
    '@': path.resolve(__dirname, '..', 'src'),
  },
  sass: {
    resource: [path.resolve(__dirname, '..', 'src/styles/common.scss')],
  },
}
