ShiJiTianKongDiPingTai/vite.config.ts

67 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-04-22 14:36:56 +08:00
import { defineApplicationConfig } from '@vben/vite-config';
import { mars3dPlugin } from 'vite-plugin-mars3d';
import path, { resolve } from 'path';
export default defineApplicationConfig({
overrides: {
optimizeDeps: {
include: [
'echarts/core',
'echarts/charts',
'echarts/components',
'echarts/renderers',
'qrcode',
'@iconify/iconify',
'ant-design-vue/es/locale/zh_CN',
'ant-design-vue/es/locale/en_US',
2024-04-24 14:01:10 +08:00
'@/../lib/vform/designer.umd.js',
2024-04-22 14:36:56 +08:00
],
},
build: {
/* 其他build生产打包配置省略 */
//...
2024-04-24 14:01:10 +08:00
target: 'esnext',
2024-04-22 14:36:56 +08:00
commonjsOptions: {
2024-04-24 14:01:10 +08:00
include: /node_modules|lib/, //这里记得把lib目录加进来否则生产打包会报错
},
2024-04-22 14:36:56 +08:00
},
server: {
proxy: {
'/basic-api': {
target: 'http://localhost:3000',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''),
// only https
// secure: false
},
'/upload': {
target: 'http://localhost:3300/upload',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp(`^/upload`), ''),
},
},
warmup: {
clientFiles: ['./index.html', './src/{views,components}/*'],
},
},
define: {
'process.env': {
BASE_URL: '/',
},
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
additionalData: `
@import "${path.resolve(__dirname, 'src/mars/components/mars-ui/base.less')}";
`,
},
},
},
plugins: [mars3dPlugin()],
},
});