deploy-ease-platform/frontend/vite.config.ts
2024-12-26 22:07:30 +08:00

58 lines
1.3 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
import fs from 'fs-extra'
// 复制 Monaco Editor 的资源文件
const copyMonacoEditorFiles = () => {
return {
name: 'copy-monaco-editor',
buildStart() {
const monacoPath = path.resolve(__dirname, 'node_modules/monaco-editor/min/vs')
const targetPath = path.resolve(__dirname, 'public/monaco-editor/min/vs')
if (!fs.existsSync(targetPath)) {
fs.copySync(monacoPath, targetPath)
}
}
}
}
export default defineConfig({
plugins: [
react(),
copyMonacoEditorFiles()
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
build: {
rollupOptions: {
output: {
manualChunks: {
'system': [
'./src/pages/System/User/index.tsx',
'./src/pages/System/Role/index.tsx',
'./src/pages/System/Menu/index.tsx',
'./src/pages/System/Department/index.tsx',
'./src/pages/System/External/index.tsx'
]
}
}
}
},
server: {
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true
}
},
fs: {
strict: false,
allow: ['..']
}
}
})