From 64430708eabeb5190998122d257ffb99c361db2a Mon Sep 17 00:00:00 2001 From: Rizumu Ayaka Date: Fri, 17 Oct 2025 09:44:04 +0800 Subject: [PATCH] perf: tree shaking and minify (#6068) ## Summary I believe tree-shaking does not affect [the shim](https://github.com/Comfy-Org/ComfyUI_frontend/blob/rizumu/perf/cloud-minify/build/plugins/comfyAPIPlugin.ts#L73), and it should safe to enable it. maybe we need to find the extension that will broke in this case. | | Rendered | Gzip | Brotli | |--------|-----------|----------|----------| | Before | 16.69 MB | 4.23 MB | 3.54 MB | | After | 12.07 MB | 3 MB | 2.53 MB | --- eslint.config.ts | 5 +---- pnpm-workspace.yaml | 6 +++--- vite.config.mts | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/eslint.config.ts b/eslint.config.ts index 4e19eba2e..23036dbd1 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -67,11 +67,8 @@ export default defineConfig([ ...commonParserOptions, projectService: { allowDefaultProject: [ - 'vite.config.mts', 'vite.electron.config.mts', - 'vite.types.config.mts', - 'playwright.config.ts', - 'playwright.i18n.config.ts' + 'vite.types.config.mts' ] } } diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 10eadc424..c6a80655f 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -98,9 +98,6 @@ catalog: cleanupUnusedCatalogs: true -overrides: - '@types/eslint': '-' - ignoredBuiltDependencies: - '@firebase/util' - protobufjs @@ -115,3 +112,6 @@ onlyBuiltDependencies: - esbuild - nx - oxc-resolver + +overrides: + '@types/eslint': '-' diff --git a/vite.config.mts b/vite.config.mts index ce22bf0a4..194133556 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -187,14 +187,12 @@ export default defineConfig({ target: 'es2022', sourcemap: true, rollupOptions: { - // Disabling tree-shaking - // Prevent vite remove unused exports - treeshake: false + treeshake: true } }, esbuild: { - minifyIdentifiers: false, + minifyIdentifiers: SHOULD_MINIFY, keepNames: true, minifySyntax: SHOULD_MINIFY, minifyWhitespace: SHOULD_MINIFY