Fix Vite import analysis of @remix-run/react
#10528
Merged
+23
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If
@remix-run/react
is not marked as external, Vite's import analysis trips up on our call toimport.meta.hot.accept
which is only valid for the classic compiler. This PR does a couple of things to address this:import.meta.hot.accept
withimport.meta.hot["accept"]
so Vite's static analysis doesn't pick it up.__remixCompiler
flag to our customimport.meta.hot
implementation in the classic compiler. This then allows us to ensure that this custom HMR logic isn't executed when using Vite.