-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Re-add esbuild's define option #9527
Comments
4 tasks
For a workaround, setting vite/packages/vite/src/node/optimizer/index.ts Lines 586 to 618 in 9e9cd23
|
Closing as this could be done by |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
#8606 removed esbuild' define option during prebundle,and it brings problems at dynamic imports case:
For example, when user are using
react
, we defineFRAMEWORK: react
here.In Vite2, vite' define options pass to esbuild' define too.esbuild will had dead code eliminated and everything ok:
However, after removing esbuild' define. Vite only define
FRAMEWORK
at runtime.During deps scanning stage, esbuild will try to bundlepreact
which the user had not installed because they are usingreact
.So esbuild throws an error thatpreact not found
.Besides, Webpack's output:
And maybe #5676 related.
Suggested solution
Pass Vite's define option to esbuild's define option.
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: