diff --git a/package.json b/package.json index 710375f..3f0af62 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "scripts": { "serve": "vite", "serve:prod": "vite --mode production", - "build:dev": "vue-tsc --noEmit && vite build --mode development", - "build:test": "vue-tsc --noEmit && vite build --mode test", + "build:dev": "node --max-old-space-size=4096 ./node_modules/vite/bin/vite.js build --mode development", + "build:test": "node --max-old-space-size=4096 ./node_modules/vite/bin/vite.js build --mode test", "build:prod": "node --max-old-space-size=4096 ./node_modules/vite/bin/vite.js build --mode production", "test": "vitest", "test:run": "vitest run", @@ -23,16 +23,11 @@ }, "dependencies": { "@ant-design/icons-vue": "^7.0.1", - "@types/big.js": "^7.0.0", "@yp-component/root": "^0.0.48", "ant-design-vue": "^4.0.0", - "big.js": "^7.0.1", "china-area-data": "^5.0.1", "dayjs": "^1.11.21", "echarts": "^5.6.0", - "express": "^5.2.1", - "html2canvas": "^1.4.1", - "qs": "^6.15.0", "vue": "^3.3.0", "vue-icons-plus": "^0.1.8", "vue-router": "^4.2.0" @@ -42,7 +37,6 @@ "@commitlint/config-conventional": "^20.4.3", "@rollup/plugin-strip": "^3.0.4", "@types/node": "^20.10.0", - "@types/qs": "^6.15.0", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@vitejs/plugin-vue": "^4.5.0", diff --git a/vite.config.ts b/vite.config.ts index 5654169..5c62106 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,12 +7,6 @@ import { resolve } from 'path'; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { - // 增大 Node 内存限制,防止构建时 OOM - const v8Flags = '--max-old-space-size=4096'; - if (!process.env.NODE_OPTIONS?.includes('max-old-space-size')) { - process.env.NODE_OPTIONS = [process.env.NODE_OPTIONS, v8Flags].filter(Boolean).join(' '); - } - const env = loadEnv(mode, process.cwd(), ''); const isProd = mode === 'production'; @@ -66,21 +60,28 @@ export default defineConfig(({ mode }) => { output: { manualChunks(id) { if (id.includes('node_modules')) { + if (id.includes('@ant-design/icons-vue')) { + return 'antd-icons'; + } if (id.includes('ant-design-vue') || id.includes('@ant-design')) { return 'antd'; } - if (id.includes('vue') || id.includes('@vue') || id.includes('vue-router')) { + if ( + id.includes('/node_modules/vue/') || + id.includes('/node_modules/@vue/') || + id.includes('/node_modules/vue-router/') + ) { return 'vue-vendor'; } if (id.includes('echarts')) { return 'echarts'; } + if (id.includes('vue-icons-plus')) { + return 'icons'; + } if (id.includes('china-area-data')) { return 'area-data'; } - if (id.includes('big.js')) { - return 'bigjs'; - } return 'vendor'; } },