-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Full es2020
compatibility by default
#9062
Comments
Vite 3 uses vite/packages/vite/src/node/constants.ts Line 17 in f020066
|
Yes Vite 2.9 doesn't target es2020 by default, but Vite 3 will. |
Thanks! Unfortunately, using
In fact, I'm no longer even able to get it to work using this: // vite.config.js
export default {
build: {
target: "es2020",
},
}; Are there still changes up in the air (such as changing (In our case, the big int code is actually dynamically loaded, and will rarely be used. But that isn't much comfort help if the compiler doesn't allow it.) |
From vitejs#9062, it sounds like the goal is to support ES2020 by default. However, the browser list was set to `safari13`, which means that big ints (an ES2020 feature) produced an error by default. This PR updates from `safari13` to `safari14` (released September 2020) to support that. Thanks for any consideration of this change!
This was a bug in Vite 2 where we used |
An alternative approach to vitejs#9062
As discussed in #9063 , If I want to ask for full |
FYI, I'm still seeing this issue in |
Even Vite 3 still seems to have issues: vitejs/vite#9062 (comment)
Even Vite 3 still seems to have issues: vitejs/vite#9062 (comment)
I think we could reopen this issue as a feature request for Vite 4. Maybe in a few months, we could already bump the modern browser's target to support BigInt. |
Even Vite 3 still seems to have issues: vitejs/vite#9062 (comment)
Even Vite 3 still seems to have issues: vitejs/vite#9062 (comment)
es2020
target by defaultes2020
compatibility by default
poke I'm still seeing this issue in Vite v3.0.4. Should I file a separate issue? |
Did you set |
Yes, I've tried all three configs, separately and at the same time:
From playing around with this for an hour, it seems that Vite 3 has either undocumented behaviour and/or caching bugs, along with potentially different behaviour depending on whether a folder is passed on the commandline (compared to defaulting to the current folder). This all makes it exceedingly difficult to tell if I'm debugging properly. 😕 |
Okay, ignoring the caching issues, it looks like there's definitely an issue with passing a root:
|
this has saved my life, thanks a lot sir God bless you |
I'm using Vite 3.1.2 without adding: optimizeDeps: {
esbuildOptions: {target: "es2020"}
}, to the vite config? Feels like a hack |
After upgrading from Vite 2 to 3.1.3 I was getting warnings like this, using custom HMR with a mostly vanilla config:
None of the solutions offered above worked for me but this (apparently undocumented) option did: // vite.config.js
export default {
esbuild: {
target: "es2020"
},
}; I have no idea what I'm doing but HMR seems to work and warnings are gone ¯\_(ツ)_/¯ It would be great if Vite maintainers could shed some more light. |
It's probably my just my ignorance, but I don't understand why it is necessary (or makes any sense) to have to set the build target it five or six places. |
Description
I help maintain a library that requires
es2020
syntax (e.g.import.meta.url
and bignum support). We'd love to recommend Vite as a bundler that works "out of the box" with batteries included, but this doesn't quite work because the default Vite target ises2019
. Our goal is to make it as easy as possible to use our library with little programming experience, and we would really like to suggest a bundler that can be run directly without configuring anything.The main
README.md
history says thates2020
used to be the target — back in 2020, actually!. This was revised in d416072 but I can't find out the reasoning why.I was able to find some discussions and suggestions to update, such as #7279 , but they don't seem to shed any light on this.
Now that it's 2022 and ES2020 is well supported in browsers, would it be possible to revise the default?
If not, could I ask for the reasoning for the current default, and what compatibility threshold might allow it to be revised in the future?
Thanks!
Suggested solution
Change the default target to
es2020
.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: