-
-
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
feat: allow import.meta.hot define override #8944
Conversation
✅ Deploy Preview for vite-docs-main canceled.
|
Vite usually does not transform libraries under node_modules, so having |
Oh I didn't know that. Could it be because in Vite 2, esbuild was incorrectly transforming |
If the dep get optimized would that still work? |
I guess it would because |
One thing we changed in Vite 3 is that optimized deps are going now through the vite plugin pipeline, as we need to replicate what the build did in v2 with plugin commonjs |
Description
Fix #8921
This allows users to preserve
import.meta.hot
in the build by usingdefine: { 'import.meta.hot': 'import.meta.hot' }
in the config. Being able to preserve these keywords in the final build is useful for library development builds that want to include HMR code directly in the library.Additional context
Not sure if this requires more tests than what I've provided, but if so, let me know where and I can add them.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).