HumanBreak/vite.config.ts

70 lines
1.9 KiB
TypeScript
Raw Normal View History

2022-11-13 18:02:05 +08:00
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import legacy from '@vitejs/plugin-legacy';
import components from 'unplugin-vue-components/vite';
2022-11-16 23:01:23 +08:00
import vuejsx from '@vitejs/plugin-vue-jsx'
2022-11-13 18:02:05 +08:00
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import motaConfig from './mota.config';
const FSHOST = 'http://127.0.0.1:3000/';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
2022-11-16 23:01:23 +08:00
vuejsx(),
2022-11-13 18:02:05 +08:00
legacy({
targets: ['defaults', 'not IE 11'],
polyfills: true,
modernPolyfills: true
}),
components({ resolvers: [AntDesignVueResolver()] })
],
base: `/games/${motaConfig.name}/`,
build: {
rollupOptions: {
output: {
manualChunks: {
antdv: ['ant-design-vue', '@ant-design/icons-vue'],
2023-05-15 22:38:24 +08:00
common: ['lodash-es', 'axios', 'lz-string', 'chart.js', 'mutate-animate', 'three']
2022-11-13 18:02:05 +08:00
}
}
}
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
}
},
server: {
proxy: {
'/readFile': FSHOST,
'/writeFile': FSHOST,
'/writeMultiFiles': FSHOST,
'/listFile': FSHOST,
'/makeDir': FSHOST,
'/moveFile': FSHOST,
'/deleteFile': FSHOST,
'^/all/.*': {
target: FSHOST,
changeOrigin: true,
rewrite(path) {
return path.replace(/^\/all/, '');
},
2023-05-13 21:47:37 +08:00
},
'^/forceTem/.*': {
target: FSHOST,
changeOrigin: true,
rewrite(path) {
return path.replace(/^\/forceTem/, '');
},
2022-11-13 18:02:05 +08:00
}
},
watch: {
ignored: ['**/public/**']
2023-02-10 16:39:53 +08:00
},
2022-11-13 18:02:05 +08:00
}
});