fix: 修复服务器打包问题
This commit is contained in:
@@ -121,9 +121,9 @@ export default defineConfig(({ mode }) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
esbuild: {
|
esbuild: {
|
||||||
drop: ["console", "debugger"],
|
drop: ['console', 'debugger'],
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: 'dist', // 指定输出路径
|
outDir: 'dist', // 指定输出路径
|
||||||
assetsDir: 'assets', // 指定生成静态文件目录
|
assetsDir: 'assets', // 指定生成静态文件目录
|
||||||
@@ -131,25 +131,12 @@ export default defineConfig(({ mode }) => {
|
|||||||
cssCodeSplit: true, // 启用 CSS 代码拆分
|
cssCodeSplit: true, // 启用 CSS 代码拆分
|
||||||
sourcemap: false, // 构建后是否生成 source map 文件
|
sourcemap: false, // 构建后是否生成 source map 文件
|
||||||
minify: 'esbuild', // 指定使用哪种混淆器
|
minify: 'esbuild', // 指定使用哪种混淆器
|
||||||
polyfillModulePreload: true,
|
polyfillModulePreload: true,
|
||||||
write: true, // 启用将构建后的文件写入磁盘
|
write: true, // 启用将构建后的文件写入磁盘
|
||||||
emptyOutDir: true, // 构建时清空该目录
|
emptyOutDir: true, // 构建时清空该目录
|
||||||
brotliSize: true, // 启用 brotli 压缩大小报告
|
brotliSize: true, // 启用 brotli 压缩大小报告
|
||||||
chunkSizeWarningLimit: 2000, // chunk 大小警告的限制
|
chunkSizeWarningLimit: 2000, // chunk 大小警告的限制
|
||||||
watch: null, // 设置为 {} 则会启用 rollup 的监听器
|
watch: null, // 设置为 {} 则会启用 rollup 的监听器
|
||||||
rollupOptions: {
|
|
||||||
// 自定义底层的 Rollup 打包配置
|
|
||||||
output: {
|
|
||||||
chunkFileNames: 'js/[name]-[hash].js', // 引入文件名的名称
|
|
||||||
entryFileNames: 'js/[name]-[hash].js', // 包的入口文件名称
|
|
||||||
assetFileNames: '[ext]/[name]-[hash].[ext]', // 资源文件像 字体,图片等
|
|
||||||
manualChunks(id: any) {
|
|
||||||
if (id.includes('node_modules')) {
|
|
||||||
return id.toString().split('node_modules/')[1].split('/')[0].toString()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
|
Reference in New Issue
Block a user