123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- // 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({
- outputPath: 'huanart',
- define: {
- GENERATE_SOURCEMAP: false,
- REACT_APP_LOCALE: 'zh-Hans',
- REACT_APP_APP_BASE_URL: 'https://www.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://api.huanart.com/api/Material/Upload',
- REACT_APP_MATERIAL_ZIP_URL: 'https://api.huanart.com/api/Material/UploadZip',
- REACT_APP_REMOTE_SERVICE_BASE_URL: 'https://api.huanart.com',
- REACT_APP_WEIXIN_APPID: 'wx331ff3da84697769',
- REACT_APP_SITE_NAME: '欢画',
- REACT_APP_SITE_SHORT_NAME: '欢画',
- REACT_APP_SITE_THEME: 'dark',
- UMI_ENV: 'huanart',
- },
- theme: {
- 'primary-color': '#1890ff',
- },
- copy: [
- { from: 'src/assets/huanart', to: './' },
- { from: 'src/ico/favicon-huanart.ico', to: './favicon.ico' },
- ],
- 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,
- // },
- // },
- // },
- // },
- // })
- config.merge({
- optimization: {
- splitChunks: {
- chunks: 'all',
- minSize: 30000,
- minChunks: 3,
- automaticNameDelimiter: '.',
- cacheGroups: {
- vendor: {
- name: 'vendors',
- test({ resource }: any) {
- return /[\\/]node_modules[\\/]/.test(resource)
- },
- priority: 10,
- },
- },
- },
- },
- })
- },
- plugins: [],
- })
|