12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- // https://umijs.org/config/
- import { defineConfig } from 'umi'
- // import pagerouters from './config/routes'
- // import LodashModuleReplacementPlugin from 'lodash-webpack-plugin'
- // import CompressionPlugin from 'compression-webpack-plugin'
- export default defineConfig({
- define: {
- GENERATE_SOURCEMAP: false,
- REACT_APP_LOCALE: 'zh-Hans',
- REACT_APP_APP_BASE_URL: 'https://uat.huanart.com',
- // REACT_APP_MATERIAL_UPLOAD_URL: 'http://192.168.50.44:21022/api/Material/Upload',
- // REACT_APP_REMOTE_SERVICE_BASE_URL: 'http://192.168.50.44:21022',
- REACT_APP_MATERIAL_UPLOAD_URL: 'https://uatapi.huanart.com/api/Material/Upload',
- REACT_APP_MATERIAL_ZIP_URL: 'https://uatapi.huanart.com/api/Material/UploadZip',
- REACT_APP_REMOTE_SERVICE_BASE_URL: 'https://uatapi.huanart.com',
- REACT_APP_WEIXIN_APPID: 'wx331ff3da84697769',
- REACT_APP_SITE_NAME: '欢画测试环境',
- REACT_APP_SITE_SHORT_NAME: '欢画UAT',
- REACT_APP_SITE_THEME: 'dark',
- UMI_ENV: 'huanart',
- },
- theme: {
- 'primary-color': '#1890ff',
- },
- chunks: ['vendors', 'umi'],
- chainWebpack(config) {
- config.module
- .rule('mjs$')
- .test(/.mjs$/)
- .include.add(/node_modules/)
- .end()
- .type('javascript/auto')
-
- config.output.filename('[name].bundle.[hash:8].js')
- config.output.chunkFilename('[chunkhash:8].chunk.js')
- // // config.plugin('dayjs').use(new AntdDayjsWebpackPlugin())
- // config.plugin('lodash-webpack-plugin').use(
- // new LodashModuleReplacementPlugin({
- // shorthands: true,
- // collections: true,
- // paths: true,
- // }),
- // )
- // if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'ado5') {
- // 开启gzip
- // config.plugin('compression-webpack-plugin').use(
- // //@ts-ignore
- // new CompressionPlugin({
- // test: /\.js$|\.html$|\.css$/, //匹配文件名
- // threshold: 10240, //对超过10k的数据压缩
- // deleteOriginalAssets: false, //不删除源文件
- // }),
- // )
- config.merge({
- optimization: {
- splitChunks: {
- chunks: 'all',
- automaticNameDelimiter: '.',
- name: true,
- minSize: 30000,
- minChunks: 1,
- cacheGroups: {
- vendors: {
- name: 'vendors',
- chunks: 'all',
- test: /[\\/]node_modules[\\/]/,
- priority: -12,
- },
- },
- },
- },
- })
- },
- plugins: [],
- })
|