Skip to content

Commit

Permalink
resolve: npm run build failure, set chunkSizeWarningLimit to 600KiB
Browse files Browse the repository at this point in the history
  • Loading branch information
YeungHoiChiu committed Aug 8, 2024
1 parent 83ede29 commit 464f600
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions vite.config.js
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'),
},
},
});

0 comments on commit 464f600

Please sign in to comment.