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';
|
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/';
|
|
|
|
|
2024-11-27 11:02:11 +08:00
|
|
|
const custom = [
|
|
|
|
'container', 'image', 'sprite', 'shader', 'text', 'comment', 'custom',
|
2024-11-27 22:01:22 +08:00
|
|
|
'layer', 'layer-group', 'animate', 'damage', 'graphics', 'icon'
|
2024-11-27 11:02:11 +08:00
|
|
|
]
|
|
|
|
|
2022-11-13 18:02:05 +08:00
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [
|
2024-11-27 11:02:11 +08:00
|
|
|
vue({
|
|
|
|
customElement: custom
|
|
|
|
}),
|
|
|
|
vuejsx({
|
|
|
|
isCustomElement: (tag) => {
|
2024-11-27 21:19:46 +08:00
|
|
|
return custom.includes(tag) || tag.startsWith('g-');
|
2024-11-27 11:02:11 +08:00
|
|
|
}
|
|
|
|
}),
|
2022-11-13 18:02:05 +08:00
|
|
|
legacy({
|
|
|
|
targets: ['defaults', 'not IE 11'],
|
|
|
|
polyfills: true,
|
|
|
|
modernPolyfills: true
|
|
|
|
}),
|
|
|
|
components({ resolvers: [AntDesignVueResolver()] })
|
|
|
|
],
|
2024-05-12 20:55:12 +08:00
|
|
|
base: `./`,
|
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
|
|
|
}
|
|
|
|
});
|