config.mock.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: 'http://192.168.50.44:8000',
  11. REACT_APP_MATERIAL_UPLOAD_URL: 'http://192.168.50.44:21029/api/Material/Upload',
  12. REACT_APP_MATERIAL_ZIP_URL: 'http://192.168.50.44:21029/api/Material/UploadZip',
  13. REACT_APP_REMOTE_SERVICE_BASE_URL: 'http://192.168.50.44:21029',
  14. REACT_APP_WEIXIN_APPID: 'wx9788037ac9f7521e',
  15. REACT_APP_SITE_NAME: '高端装饰画图库',
  16. REACT_APP_SITE_SHORT_NAME: '高端装饰画图库',
  17. REACT_APP_SITE_THEME: 'light',
  18. UMI_ENV: 'laitin',
  19. },
  20. theme: {
  21. 'primary-color': '#1890ff',
  22. },
  23. chunks: ['vendors', 'umi'],
  24. chainWebpack(config) {
  25. config.output.filename('[name].bundle.[hash:8].js')
  26. config.output.chunkFilename('[chunkhash:8].chunk.js')
  27. // // config.plugin('dayjs').use(new AntdDayjsWebpackPlugin())
  28. // config.plugin('lodash-webpack-plugin').use(
  29. // new LodashModuleReplacementPlugin({
  30. // shorthands: true,
  31. // collections: true,
  32. // paths: true,
  33. // }),
  34. // )
  35. // if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'ado5') {
  36. // 开启gzip
  37. // config.plugin('compression-webpack-plugin').use(
  38. // //@ts-ignore
  39. // new CompressionPlugin({
  40. // test: /\.js$|\.html$|\.css$/, //匹配文件名
  41. // threshold: 10240, //对超过10k的数据压缩
  42. // deleteOriginalAssets: false, //不删除源文件
  43. // }),
  44. // )
  45. config.merge({
  46. optimization: {
  47. splitChunks: {
  48. chunks: 'all',
  49. automaticNameDelimiter: '.',
  50. name: true,
  51. minSize: 30000,
  52. minChunks: 1,
  53. cacheGroups: {
  54. vendors: {
  55. name: 'vendors',
  56. chunks: 'all',
  57. test: /[\\/]node_modules[\\/]/,
  58. priority: -12,
  59. },
  60. },
  61. },
  62. },
  63. })
  64. },
  65. plugins: [],
  66. })