From 1df57c9e3d6d6398714250e6d16711c3f25105ee Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 18 Apr 2026 02:48:14 +0200 Subject: [PATCH 1/8] Bump Vite build target to es2022 Top-level await (used in frontend-openapi-swagger.ts for the CSS import) requires es2022. This silences the TOLERATED_TRANSFORM warning emitted on each build. Browser support for es2022 is available in Chrome 94+, Firefox 93+ and Safari 15+. Co-Authored-By: Claude (Opus 4.7) --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 731726c318331..3286f626c0658 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -55,7 +55,7 @@ function commonViteOpts({build, ...other}: InlineConfig): InlineConfig { outDir, emptyOutDir: false, sourcemap: enableSourcemap !== 'false', - target: 'es2020', + target: 'es2022', minify: isProduction ? 'oxc' : false, cssMinify: isProduction ? 'esbuild' : false, chunkSizeWarningLimit: Infinity, From 7b0ea04a56385cd78617b4a3913b876592c46c77 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 18 Apr 2026 02:57:17 +0200 Subject: [PATCH 2/8] Fail Vite build on rolldown warnings in CI Install an onwarn handler in commonRolldownOptions that throws when env.CI is set. In local builds the default handler still prints the warning, but CI promotes it to a build failure so tolerated warnings can't silently land on main. Co-Authored-By: Claude (Opus 4.7) --- vite.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index 3286f626c0658..d21b95952abfc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -42,6 +42,11 @@ const commonRolldownOptions: Rolldown.RolldownOptions = { checks: { pluginTimings: false, }, + ...(env.CI ? { + onwarn(warning: Rolldown.RolldownLog) { + throw new Error(`[rolldown] ${warning.code}: ${warning.message}`); + }, + } : {}), }; function commonViteOpts({build, ...other}: InlineConfig): InlineConfig { From dc9a5aa7b03e4a9259f70448cd8bbd3dd6975b79 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 18 Apr 2026 10:25:55 +0200 Subject: [PATCH 3/8] Apply suggestion from @silverwind Signed-off-by: silverwind --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index d21b95952abfc..727ec44a35bd2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -60,7 +60,7 @@ function commonViteOpts({build, ...other}: InlineConfig): InlineConfig { outDir, emptyOutDir: false, sourcemap: enableSourcemap !== 'false', - target: 'es2022', + target: 'es2020', minify: isProduction ? 'oxc' : false, cssMinify: isProduction ? 'esbuild' : false, chunkSizeWarningLimit: Infinity, From cfc08539d8189bf15db5e2867107070f59a2bdb7 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 19 Apr 2026 22:20:22 +0200 Subject: [PATCH 4/8] Use plugin with log counter for CI warning failure Replace the onwarn throw with a rolldown plugin that increments a counter in onLog and exits with a clean message in buildEnd. Shows all warnings in one run instead of aborting on the first, and avoids the long plugin-error stack trace. Co-Authored-By: Claude (Opus 4.7) --- vite.config.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 727ec44a35bd2..592cfba473aa5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -38,15 +38,26 @@ const webComponents = new Set([ 'text-expander', ]); +function failOnWarningsPlugin(): Rolldown.Plugin { + let warningCount = 0; + return { + name: 'fail-on-warnings', + onLog(level) { + if (level === 'warn') warningCount++; + }, + buildEnd() { + if (!warningCount) return; + console.error(`\nerror: ${warningCount} warnings present`); + process.exit(1); + }, + }; +} + const commonRolldownOptions: Rolldown.RolldownOptions = { checks: { pluginTimings: false, }, - ...(env.CI ? { - onwarn(warning: Rolldown.RolldownLog) { - throw new Error(`[rolldown] ${warning.code}: ${warning.message}`); - }, - } : {}), + ...(env.CI ? {plugins: [failOnWarningsPlugin()]} : {}), }; function commonViteOpts({build, ...other}: InlineConfig): InlineConfig { From fd0c24a801fbe6c2012ca4699dab1736ef43a3ff Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 19 Apr 2026 22:54:18 +0200 Subject: [PATCH 5/8] Throw from buildEnd instead of calling process.exit Addresses review feedback: calling process.exit(1) from a plugin hook bypasses Vite/Rolldown cleanup and can truncate logs. Throwing routes failure through the normal error path. Co-Authored-By: Claude (Opus 4.7) --- vite.config.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 592cfba473aa5..36907a9bc2695 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -47,8 +47,7 @@ function failOnWarningsPlugin(): Rolldown.Plugin { }, buildEnd() { if (!warningCount) return; - console.error(`\nerror: ${warningCount} warnings present`); - process.exit(1); + throw new Error(`${warningCount} warnings treated as errors`); }, }; } From 0a2f923dbea5c6907c7e75e64ddabd77bfe4d08f Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 19 Apr 2026 22:55:39 +0200 Subject: [PATCH 6/8] Apply suggestion from @silverwind Signed-off-by: silverwind --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 36907a9bc2695..e0990af58fcc4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -47,7 +47,7 @@ function failOnWarningsPlugin(): Rolldown.Plugin { }, buildEnd() { if (!warningCount) return; - throw new Error(`${warningCount} warnings treated as errors`); + throw new Error(`${warningCount} warnings present`); }, }; } From f065993f1383ac7dacb43240b8e4dc1209c95ddb Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 21 Apr 2026 19:58:40 +0200 Subject: [PATCH 7/8] Gate rolldown warn-as-error on NODE_ENV=test Switch from env.CI to env.NODE_ENV === 'test' and set NODE_ENV=test in the CI frontend/e2e build steps and in the test-e2e Makefile target. Local `make frontend` stays untouched; e2e runs fail on warnings both in CI and locally. Co-Authored-By: Claude (Opus 4.7) --- .github/workflows/pull-compliance.yml | 2 ++ .github/workflows/pull-e2e-tests.yml | 2 ++ Makefile | 3 ++- vite.config.ts | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index dd453d00bebf7..46a02652be047 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -181,6 +181,8 @@ jobs: - run: make checks-frontend - run: make test-frontend - run: make frontend + env: + NODE_ENV: test backend: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml index fde36383b93f9..6031d1684724d 100644 --- a/.github/workflows/pull-e2e-tests.yml +++ b/.github/workflows/pull-e2e-tests.yml @@ -33,6 +33,8 @@ jobs: cache-dependency-path: pnpm-lock.yaml - run: make deps-frontend - run: make frontend + env: + NODE_ENV: test - run: make deps-backend - run: make gitea-e2e - run: make playwright diff --git a/Makefile b/Makefile index e621cc362fce4..38609e89bcbdd 100644 --- a/Makefile +++ b/Makefile @@ -522,7 +522,8 @@ playwright: deps-frontend @pnpm exec playwright install $(if $(GITHUB_ACTIONS),,--with-deps) chromium firefox $(PLAYWRIGHT_FLAGS) .PHONY: test-e2e -test-e2e: playwright $(EXECUTABLE_E2E) +test-e2e: playwright + @NODE_ENV=test $(MAKE) $(EXECUTABLE_E2E) @EXECUTABLE=$(EXECUTABLE_E2E) ./tools/test-e2e.sh $(GITEA_TEST_E2E_FLAGS) .PHONY: bench-sqlite diff --git a/vite.config.ts b/vite.config.ts index 53717813a1021..9a311742cf1ce 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -56,7 +56,7 @@ const commonRolldownOptions: Rolldown.RolldownOptions = { checks: { pluginTimings: false, }, - ...(env.CI ? {plugins: [failOnWarningsPlugin()]} : {}), + ...(env.NODE_ENV === 'test' ? {plugins: [failOnWarningsPlugin()]} : {}), }; function commonViteOpts({build, ...other}: InlineConfig): InlineConfig { From 70add36557acd6a8c4b60989d88b2bad17fb9b12 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 21 Apr 2026 20:09:37 +0200 Subject: [PATCH 8/8] Revert "Gate rolldown warn-as-error on NODE_ENV=test" This reverts commit f065993f1383ac7dacb43240b8e4dc1209c95ddb. --- .github/workflows/pull-compliance.yml | 2 -- .github/workflows/pull-e2e-tests.yml | 2 -- Makefile | 3 +-- vite.config.ts | 2 +- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index 46a02652be047..dd453d00bebf7 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -181,8 +181,6 @@ jobs: - run: make checks-frontend - run: make test-frontend - run: make frontend - env: - NODE_ENV: test backend: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml index 6031d1684724d..fde36383b93f9 100644 --- a/.github/workflows/pull-e2e-tests.yml +++ b/.github/workflows/pull-e2e-tests.yml @@ -33,8 +33,6 @@ jobs: cache-dependency-path: pnpm-lock.yaml - run: make deps-frontend - run: make frontend - env: - NODE_ENV: test - run: make deps-backend - run: make gitea-e2e - run: make playwright diff --git a/Makefile b/Makefile index 38609e89bcbdd..e621cc362fce4 100644 --- a/Makefile +++ b/Makefile @@ -522,8 +522,7 @@ playwright: deps-frontend @pnpm exec playwright install $(if $(GITHUB_ACTIONS),,--with-deps) chromium firefox $(PLAYWRIGHT_FLAGS) .PHONY: test-e2e -test-e2e: playwright - @NODE_ENV=test $(MAKE) $(EXECUTABLE_E2E) +test-e2e: playwright $(EXECUTABLE_E2E) @EXECUTABLE=$(EXECUTABLE_E2E) ./tools/test-e2e.sh $(GITEA_TEST_E2E_FLAGS) .PHONY: bench-sqlite diff --git a/vite.config.ts b/vite.config.ts index 9a311742cf1ce..53717813a1021 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -56,7 +56,7 @@ const commonRolldownOptions: Rolldown.RolldownOptions = { checks: { pluginTimings: false, }, - ...(env.NODE_ENV === 'test' ? {plugins: [failOnWarningsPlugin()]} : {}), + ...(env.CI ? {plugins: [failOnWarningsPlugin()]} : {}), }; function commonViteOpts({build, ...other}: InlineConfig): InlineConfig {