Skip to content

transformer: engine support and lowering #10618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TheAlexLichter opened this issue Apr 25, 2025 · 3 comments
Closed

transformer: engine support and lowering #10618

TheAlexLichter opened this issue Apr 25, 2025 · 3 comments
Assignees
Labels
A-transformer Area - Transformer / Transpiler P-high Priority - High

Comments

@TheAlexLichter
Copy link
Member

When using OXC to build for a specific target, it would be helpful to be browserslist-compatible in terms of output and format. Two issues that I've discovered:

  • Not all engines emitted via browserslist are available, such as and_chr135 (android chrome)
  • When setting two targets for the same engine, such as ['chrome135', 'chrome134'], the build will fail instead of combining requirements for both engines or accepting the lowest.

Reproduction

Originally via vitejs/rolldown-vite#140

@Boshen
Copy link
Member

Boshen commented Apr 25, 2025

Not all engines emitted via browserslist are available, such as and_chr135 (android chrome)

This is due to not updating browserslist data for at least two months ... updated in #10625

@Boshen
Copy link
Member

Boshen commented Apr 25, 2025

When setting two targets for the same engine, such as ['chrome135', 'chrome134'], the build will fail instead of combining requirements for both engines or accepting the lowest.

I did some logging and testing in esbuild:

https://github.com/evanw/esbuild/blob/5959289d90667c5a4026e6fb32cc58bbed9fc88a/pkg/api/api_impl.go#L360

	fmt.Println(targetEnv)
 make esbuild && ./esbuild --target="chrome125,chrome120,es2015,es2022" test.js
"chrome120", "es2022"
make esbuild && ./esbuild --target="chrome120,chrome125,es2022,es2015" test.js
"chrome125", "es2015"

It resolves to the last value.

Testing in the playground:

--target=es2022,es2015 transforms: https://esbuild.github.io/try/#dAAwLjI0LjAALS10YXJnZXQ9ZXMyMDI0LGVzMjAxNQBhID8/IGI

--target=es2015,es2024 does not transform: https://esbuild.github.io/try/#dAAwLjI0LjAALS10YXJnZXQ9ZXMyMDE1LGVzMjAyNABhID8/IGI


So to our surprise, esbuild just picks the last value for the target.

I'm in favor of keeping the current behavior (report Error: 'chrome134' is already specified.) to remove the ambiguity.

And maybe report this to esbuild to surface the problem.

@Boshen
Copy link
Member

Boshen commented Apr 28, 2025

browserslist getting updated in Rolldown rolldown/rolldown#4353

Closing the Error: 'chrome134' is already specified. as won't fix right now because I think it removes ambiguity.

Reposted my above comment to upstream issue.

@Boshen Boshen closed this as completed Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-transformer Area - Transformer / Transpiler P-high Priority - High
Projects
None yet
Development

No branches or pull requests

2 participants