HumanBreak/vite.config.ts

89 lines
2.5 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';
2023-10-22 12:05:06 +08:00
import { resolve } from 'path';
2024-04-26 17:39:20 +08:00
import postcssPresetEnv from 'postcss-preset-env';
2022-11-13 18:02:05 +08:00
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}/`,
2023-10-22 12:05:06 +08:00
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'@ui': resolve(__dirname, './src/ui')
}
},
2022-11-13 18:02:05 +08:00
build: {
rollupOptions: {
output: {
manualChunks: {
antdv: ['ant-design-vue', '@ant-design/icons-vue'],
2023-09-30 11:04:57 +08:00
common: [
'lodash-es',
'axios',
'lz-string',
'chart.js',
'mutate-animate',
'@vueuse/core'
]
2022-11-13 18:02:05 +08:00
}
}
}
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
2024-04-26 17:39:20 +08:00
},
postcss: {
plugins: [postcssPresetEnv()]
2022-11-13 18:02:05 +08:00
}
},
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/, '');
},
2024-04-22 23:08:46 +08:00
},
'/danmaku': 'https://h5mota.com/backend/tower/barrage.php'
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
}
});