You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ mode, command }) => {
|
|
const outDirMap = {
|
|
development: 'dist-test',
|
|
product: 'dist-prod'
|
|
}
|
|
|
|
return {
|
|
plugins: [
|
|
vue(),
|
|
vueDevTools(),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
},
|
|
},
|
|
build: {
|
|
outDir: outDirMap[mode] || 'dist',
|
|
rollupOptions: {
|
|
input: {
|
|
main: './index.html',
|
|
download: './hcdbqb-download.html',
|
|
guide: './hcdbqb-guide.html',
|
|
management: './hcdbqb-management.html'
|
|
},
|
|
// 配置代码分割
|
|
output: {
|
|
manualChunks: undefined, // 禁用自动代码分割
|
|
chunkFileNames: 'assets/[name]-[hash].js',
|
|
entryFileNames: 'assets/[name]-[hash].js'
|
|
}
|
|
}
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
open: true
|
|
}
|
|
}
|
|
})
|