You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB
TypeScript

import path from 'path';
import TerserPlugin from 'terser-webpack-plugin';
import { defineConfig } from 'umi';
import { appName } from './src/conf.json';
import routes from './src/routes';
export default defineConfig({
title: appName,
outputPath: 'dist',
alias: { '@parent': path.resolve(__dirname, '../') },
npmClient: 'npm',
base: '/flowapp/',
publicPath: '/flowapp/',
runtimePublicPath: false,
mfsu: false,
routes,
esbuildMinifyIIFE: true,
icons: {},
hash: true, // 生产环境开启 hash
favicons: ['/flowapp/flow-app.png'],
headScripts: [{ src: '/flowapp/iconfont.js', defer: true }],
clickToComponent: {},
history: {
type: 'browser',
},
plugins: [
'@react-dev-inspector/umi4-plugin',
'@umijs/plugins/dist/tailwindcss',
],
jsMinifier: 'terser',
jsMinifierOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
lessLoader: {
modifyVars: {
hack: `true; @import "~@/less/index.less";`,
},
},
devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',
copy: [
{ from: 'src/conf.json', to: 'dist/conf.json' },
{ from: 'node_modules/monaco-editor/min/vs/', to: 'dist/vs/' },
],
proxy: {
'/api': {
target: 'http://ngsk.tech:29380',
changeOrigin: true,
},
'/databuilder/v1': {
target: 'http://192.168.8.131:29380',
changeOrigin: true,
pathRewrite: { '^/databuilder': '/' },
},
},
writeToDisk: true,
chainWebpack(memo, args) {
memo.module.rule('markdown').test(/\.md$/).type('asset/source');
memo.optimization.minimizer('terser').use(TerserPlugin);
return memo;
},
tailwindcss: {},
});