fix: 修复nginx启动render页空白问题

This commit is contained in:
sudoooooo 2024-07-08 21:06:30 +08:00
parent 61fd6e09af
commit 6c72344204

View File

@ -2,7 +2,9 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig, normalizePath } from 'vite' import { defineConfig, normalizePath } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx' import vueJsx from '@vitejs/plugin-vue-jsx'
import { createMpaPlugin, createPages } from 'vite-plugin-virtual-mpa' import { createMpaPlugin, createPages } from 'vite-plugin-virtual-mpa'
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite' import Components from 'unplugin-vue-components/vite'
import Icons from 'unplugin-icons/vite' import Icons from 'unplugin-icons/vite'
@ -116,6 +118,31 @@ export default defineConfig({
} }
}, },
build: { build: {
rollupOptions: {} rollupOptions: {
output: {
assetFileNames: '[ext]/[name]-[hash].[ext]',
chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'js/[name]-[hash].js',
manualChunks(id) {
// 建议根据项目生产实际情况进行优化部分可走cdn或进行小资源包合并
if (id.includes('element-plus')) {
return 'element-plus'
}
if (id.includes('wangeditor')) {
return 'wangeditor'
}
if (id.includes('node-forg')) {
return 'node-forg'
}
if (id.includes('echarts')) {
return 'echarts'
}
if (id.includes('node_modules')) {
return 'packages'
}
}
}
}
} }
}) })