123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- // 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: 'laitin',
- define: {
- GENERATE_SOURCEMAP: false,
- REACT_APP_LOCALE: 'zh-Hans',
- REACT_APP_APP_BASE_URL: 'https://www.laitin-art.com',
- REACT_APP_MATERIAL_UPLOAD_URL: 'https://api.laitin-art.com/api/Material/Upload',
- REACT_APP_MATERIAL_ZIP_URL: 'https://api.laitin-art.com/api/Material/UploadZip',
- REACT_APP_REMOTE_SERVICE_BASE_URL: 'https://api.laitin-art.com',
- REACT_APP_WEIXIN_APPID: 'wx9788037ac9f7521e',
- REACT_APP_SITE_NAME: '高端装饰画图库',
- REACT_APP_SITE_SHORT_NAME: '高端装饰画图库',
- REACT_APP_SITE_THEME: 'light',
- UMI_ENV: 'laitin',
- },
- theme: {
- 'primary-color': '#1890ff',
- },
- chunks: ['vendors', 'umi'],
- copy: [
- { from: 'src/assets/laitin', to: './' },
- ],
- 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',
- minSize: 30000,
- minChunks: 3,
- automaticNameDelimiter: '.',
- cacheGroups: {
- vendor: {
- name: 'vendors',
- test({ resource }: any) {
- return /[\\/]node_modules[\\/]/.test(resource)
- },
- priority: 10,
- },
- },
- },
- },
- })
- },
- plugins: [],
- })
|