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.

66 lines
2.0 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, // 禁用运行时 publicPath
mfsu: false, // 禁用 MFSU 避免模块联邦冲突
routes,
esbuildMinifyIIFE: true,
icons: {},
hash: false, // 开发环境关闭 hash
favicons: ['/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: 'none', // Fixed the issue that the page displayed an error after packaging lexical with terser
lessLoader: {
modifyVars: {
hack: `true; @import "~@/less/index.less";`,
},
},
devtool: '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://192.168.1.6:9380',
target: 'http://ngsk.tech:29380',
changeOrigin: true,
},
'/databuilder/v1': {
// target: 'http://192.168.1.5:9380',
// target: 'http://192.168.131.159:9380',
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); // Fixed the issue that the page displayed an error after packaging lexical with terser
return memo;
},
tailwindcss: {},
});