Skip to content
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

Respect Browserslist config in esbuild #11489

Open
4 tasks done
ai opened this issue Dec 26, 2022 · 4 comments
Open
4 tasks done

Respect Browserslist config in esbuild #11489

ai opened this issue Dec 26, 2022 · 4 comments

Comments

@ai
Copy link

ai commented Dec 26, 2022

Description

esbuild doesn’t have built-in Browserslist config.

Benefits:

  • Autoprefixer, postcss-preset-env, Babel and many other tools have. So users may expect Browserslist config.
  • It is great to have only single config to specify target browsers for all tools.
  • With Browserslist config, we can reduce polyfills in esbuild output and make JS works faster.

Suggested solution

We can use browserslist-to-esbuild as suggested in When Vite ignores your Browserslist configuration article.

In this case, Vite will look for Browserslist config and auto-fill build.target config option.

Alternative

No response

Additional context

Browserslist also supports Node.js versions

Validations

@alexanderniebuhr
Copy link

I could understand why for JS features, someone would like to stick with esbuild target syntax. However for css features I don't see any value in it. Vite should allow both syntaxes maybe?

But IMO it would be an easier bet to initially support build.cssTarget, which is used for css feature support (at least in the new v4.4 beta) and adopt build.target later.

@yisibl
Copy link

yisibl commented Nov 7, 2023

Browserslist is already the most common and versatile syntax in the front-end ecosystem, and I strongly support this proposal.

@milton-imageline
Copy link

100%, this makes a lot of sense.

@SinaKarimi7
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants