config.uat.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // https://umijs.org/config/
  2. import { defineConfig } from 'umi'
  3. // import pagerouters from './config/routes'
  4. // import LodashModuleReplacementPlugin from 'lodash-webpack-plugin'
  5. // import CompressionPlugin from 'compression-webpack-plugin'
  6. export default defineConfig({
  7. define: {
  8. GENERATE_SOURCEMAP: false,
  9. REACT_APP_LOCALE: 'zh-Hans',
  10. REACT_APP_APP_BASE_URL: 'https://uat.huanart.com',
  11. // REACT_APP_MATERIAL_UPLOAD_URL: 'http://192.168.50.44:21022/api/Material/Upload',
  12. // REACT_APP_REMOTE_SERVICE_BASE_URL: 'http://192.168.50.44:21022',
  13. REACT_APP_MATERIAL_UPLOAD_URL: 'https://uatapi.huanart.com/api/Material/Upload',
  14. REACT_APP_MATERIAL_ZIP_URL: 'https://uatapi.huanart.com/api/Material/UploadZip',
  15. REACT_APP_REMOTE_SERVICE_BASE_URL: 'https://uatapi.huanart.com',
  16. REACT_APP_WEIXIN_APPID: 'wx331ff3da84697769',
  17. REACT_APP_SITE_NAME: '欢画测试环境',
  18. REACT_APP_SITE_SHORT_NAME: '欢画UAT',
  19. REACT_APP_SITE_THEME: 'dark',
  20. UMI_ENV: 'huanart',
  21. },
  22. theme: {
  23. 'primary-color': '#1890ff',
  24. },
  25. chunks: ['vendors', 'umi'],
  26. chainWebpack(config) {
  27. config.module
  28. .rule('mjs$')
  29. .test(/.mjs$/)
  30. .include.add(/node_modules/)
  31. .end()
  32. .type('javascript/auto')
  33. config.output.filename('[name].bundle.[hash:8].js')
  34. config.output.chunkFilename('[chunkhash:8].chunk.js')
  35. // // config.plugin('dayjs').use(new AntdDayjsWebpackPlugin())
  36. // config.plugin('lodash-webpack-plugin').use(
  37. // new LodashModuleReplacementPlugin({
  38. // shorthands: true,
  39. // collections: true,
  40. // paths: true,
  41. // }),
  42. // )
  43. // if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'ado5') {
  44. // 开启gzip
  45. // config.plugin('compression-webpack-plugin').use(
  46. // //@ts-ignore
  47. // new CompressionPlugin({
  48. // test: /\.js$|\.html$|\.css$/, //匹配文件名
  49. // threshold: 10240, //对超过10k的数据压缩
  50. // deleteOriginalAssets: false, //不删除源文件
  51. // }),
  52. // )
  53. config.merge({
  54. optimization: {
  55. splitChunks: {
  56. chunks: 'all',
  57. automaticNameDelimiter: '.',
  58. name: true,
  59. minSize: 30000,
  60. minChunks: 1,
  61. cacheGroups: {
  62. vendors: {
  63. name: 'vendors',
  64. chunks: 'all',
  65. test: /[\\/]node_modules[\\/]/,
  66. priority: -12,
  67. },
  68. },
  69. },
  70. },
  71. })
  72. },
  73. plugins: [],
  74. })