Skip to content

Bump Vite build target to es2022 and fail CI on rolldown warnings#37270

Closed
silverwind wants to merge 2 commits intogo-gitea:mainfrom
silverwind:es2022
Closed

Bump Vite build target to es2022 and fail CI on rolldown warnings#37270
silverwind wants to merge 2 commits intogo-gitea:mainfrom
silverwind:es2022

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Apr 18, 2026

1. Bump Vite build target to es2022

Top-level await added in d5831b9 requires es2022. This fixes the TOLERATED_TRANSFORM warning emitted on each build:

[TOLERATED_TRANSFORM] Warning: Top-level await is not available in the configured target environment.
   ╭─[ web_src/js/render/plugins/frontend-openapi-swagger.ts:2:1 ]
   │
 2 │ await import("../../../css/swagger.css");

Browser support for es2022 is available in Chrome 94+, Firefox 93+ and Safari 15+.

2. Fail the build on rolldown warnings in CI

Adds an onwarn handler in commonRolldownOptions that throws when env.CI is set, so warnings can be noticed in CI. Locally, the default handler still prints them without aborting to not break user builds.


This PR was written with the help of Claude Opus 4.7

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) <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 18, 2026
@silverwind silverwind changed the title Bump Vite build target to es2022 Bump vite build target to es2022 Apr 18, 2026
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) <noreply@anthropic.com>
@silverwind silverwind changed the title Bump vite build target to es2022 Bump Vite build target to es2022 and fail CI on rolldown warnings Apr 18, 2026
@silverwind
Copy link
Copy Markdown
Member Author

@wolfbeast fyi, this will be for v1.27.

@wxiaoguang
Copy link
Copy Markdown
Contributor

wxiaoguang commented Apr 18, 2026

Actually, I am not sure whether it really needs es2022

This await import("../../../css/swagger.css"); is only for loading CSS files, and the JS is executed in type=module. So I don't know whether the "await" is really a problem, or just a wrong warning from Vite


OK, it seems that it becomes standard in es2022, while some browsers supported it ahead.

Maybe it's better to find a way to avoid such top-level await and make the CSS importing work (if possible)

Details image

@wxiaoguang wxiaoguang marked this pull request as draft April 18, 2026 02:53
@wxiaoguang
Copy link
Copy Markdown
Contributor

The top-level await import is also caused by incorrect Vite manifest parser, it makes the CSS importing very messy.

@wxiaoguang
Copy link
Copy Markdown
Contributor

No need to use es2022

-> Fix top-level await #37272

@wxiaoguang wxiaoguang closed this Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants