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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import path from 'path';
  2. import TerserPlugin from 'terser-webpack-plugin';
  3. import { defineConfig } from 'umi';
  4. import { appName } from './src/conf.json';
  5. import routes from './src/routes';
  6. const ESLintPlugin = require('eslint-webpack-plugin');
  7. export default defineConfig({
  8. title: appName,
  9. outputPath: 'dist',
  10. alias: { '@parent': path.resolve(__dirname, '../') },
  11. npmClient: 'npm',
  12. base: '/',
  13. routes,
  14. publicPath: '/',
  15. esbuildMinifyIIFE: true,
  16. icons: {},
  17. hash: true,
  18. favicons: ['/logo.svg'],
  19. headScripts: [{ src: '/iconfont.js', defer: true }],
  20. clickToComponent: {},
  21. history: {
  22. type: 'browser',
  23. },
  24. plugins: [
  25. '@react-dev-inspector/umi4-plugin',
  26. '@umijs/plugins/dist/tailwindcss',
  27. ],
  28. jsMinifier: 'none', // Fixed the issue that the page displayed an error after packaging lexical with terser
  29. lessLoader: {
  30. modifyVars: {
  31. hack: `true; @import "~@/less/index.less";`,
  32. },
  33. },
  34. devtool: 'source-map',
  35. copy: [
  36. { from: 'src/conf.json', to: 'dist/conf.json' },
  37. { from: 'node_modules/monaco-editor/min/vs/', to: 'dist/vs/' },
  38. ],
  39. proxy: [
  40. {
  41. context: ['/api', '/v1'],
  42. target: 'http://127.0.0.1:9380/',
  43. changeOrigin: true,
  44. ws: true,
  45. logger: console,
  46. // pathRewrite: { '^/v1': '/v1' },
  47. },
  48. ],
  49. chainWebpack(memo, args) {
  50. memo.module.rule('markdown').test(/\.md$/).type('asset/source');
  51. memo.optimization.minimizer('terser').use(TerserPlugin); // Fixed the issue that the page displayed an error after packaging lexical with terser
  52. // memo.plugin('eslint').use(ESLintPlugin, [
  53. // {
  54. // extensions: ['js', 'ts', 'tsx'],
  55. // failOnError: true,
  56. // exclude: ['**/node_modules/**', '**/mfsu**', '**/mfsu-virtual-entry**'],
  57. // files: ['src/**/*.{js,ts,tsx}'],
  58. // },
  59. // ]);
  60. return memo;
  61. },
  62. tailwindcss: {},
  63. });