-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
esbuild minify unexpect transform #7179
Comments
Can you describe what the expectations are? |
polyfill? |
I write a minirepo https://stackblitz.com/edit/node-qfc2yz?devtoolsheight=33&file=index.js |
If you are bundling an app, you might use @vitejs/plugin-legacy for that. It'll take care of dynamic imports. For libraries, relying on Vite to handle dynamic imports, I believe, is not recommended. Is |
With esbuild supporting the supported: {
'dynamic-import': true,
}, and it seems to fix the issue. Perhaps we should do something similar to #8665 (this PR affects |
I think Note that |
I think polyfilling |
Sounds perfectly reasonable since dynamic imports are the new baseline for Vite |
I think so too. But isn't preserving |
Yeah I think the error would be more obvious if we preserve it. And this also helps to make sure that the modern bundle can be used by modern browsers too. If we downlevel to I tried to auto issue a warning too but I'm not sure if there's a neat way of doing so with esbuild. |
Describe the bug
when I use config for vite
esbuild transform
dynamic import
torequire
.like this:
to
may be chrome63 support
dynamic import
. chrome60 no support. But I don't think this conversion meets the expectations.I think need to polyfill
import
in chrome63Reproduction
https://stackblitz.com/edit/node-qfc2yz?devtoolsheight=33&file=index.js
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: