Skip to content

Commit

Permalink
optimize the construction parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiram committed Mar 24, 2024
1 parent 1748e57 commit 0f774da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
15 changes: 2 additions & 13 deletions electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,10 @@ export default defineConfig(({ mode }: ConfigEnv) => {
}
},
build: {
assetsInclude: ['./src/renderer/src/utils/drpy/drpy3.ts'],
minify: 'terser',
emptyOutDir: true, // 打包时先清空上一次构建生成的目录
reportCompressedSize: false, // 关闭文件计算
sourcemap: true, // 关闭生成map文件 可以达到缩小打包体积
terserOptions: {
// 禁用代码优化
compress: false,
mangle: false,
format: {
comments: false,
},
},
sourcemap: false, // 关闭生成map文件 可以达到缩小打包体积
rollupOptions: {
treeshake: false, // 关闭代码分割[重要], 否则eval执行时缺少全局变量和方法
output: {
entryFileNames: `assets/entry/[name][hash].js`, // 引入文件名的名称
chunkFileNames: `assets/chunk/[name][hash].js`, // 包的入口文件名称
Expand Down Expand Up @@ -108,7 +97,7 @@ export default defineConfig(({ mode }: ConfigEnv) => {
splitVendorChunkPlugin()
],
server: {
strictPort: true,
strictPort: true, // 端口冲突自动分配端口
proxy: {
[VITE_API_URL_PREFIX]: {
target: VITE_API_URL, // 后台接口域名
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"stylelint-order": "~6.0.4",
"tdesign-icons-vue-next": "^0.2.2",
"tdesign-vue-next": "^1.9.0",
"terser": "^5.29.2",
"typescript": "^5.4.2",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
Expand Down

0 comments on commit 0f774da

Please sign in to comment.