-
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from YeungHoiChiu/vite-config
fix: 打包错误、公共步骤中未禁用分组拖拽导致出现预期之外的结果
- Loading branch information
Showing
3 changed files
with
31 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
import {defineConfig} from 'vite'; | ||
import {join} from 'path'; | ||
import { defineConfig } from 'vite'; | ||
import { join } from 'path'; | ||
import vue from '@vitejs/plugin-vue'; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [vue()], | ||
server:{ | ||
port: 3002 | ||
}, | ||
build: { | ||
rollupOptions: { | ||
output: { | ||
manualChunks(id) { | ||
if (id.includes('node_modules')) { | ||
return id.toString().split('node_modules/')[1].split('/')[0].toString(); | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
resolve: { | ||
alias: { | ||
'@': join(__dirname, 'src'), | ||
plugins: [vue()], | ||
server: { | ||
port: 3002, | ||
}, | ||
build: { | ||
chunkSizeWarningLimit: 600 * 1024, // 设置警告阈值为600KiB,因为element-plus超过500kb导致打包失败 | ||
rollupOptions: { | ||
output: { | ||
manualChunks(id) { | ||
if (id.includes('node_modules')) { | ||
return id | ||
.toString() | ||
.split('node_modules/')[1] | ||
.split('/')[0] | ||
.toString(); | ||
} | ||
}, | ||
}, | ||
}, | ||
}, | ||
resolve: { | ||
alias: { | ||
'@': join(__dirname, 'src'), | ||
}, | ||
}, | ||
}); |