Skip to content
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

Fix Vite import analysis of @remix-run/react #10528

Merged
merged 1 commit into from
Mar 14, 2025

Conversation

markdalgleish
Copy link
Member

@markdalgleish markdalgleish commented Mar 14, 2025

If @remix-run/react is not marked as external, Vite's import analysis trips up on our call to import.meta.hot.accept which is only valid for the classic compiler. This PR does a couple of things to address this:

  • Replaces import.meta.hot.accept with import.meta.hot["accept"] so Vite's static analysis doesn't pick it up.
  • Adds a new __remixCompiler flag to our custom import.meta.hot implementation in the classic compiler. This then allows us to ensure that this custom HMR logic isn't executed when using Vite.

Copy link

changeset-bot bot commented Mar 14, 2025

🦋 Changeset detected

Latest commit: b11c4ae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@remix-run/dev Patch
@remix-run/react Patch
@remix-run/fs-routes Patch
@remix-run/route-config Patch
@remix-run/routes-option-adapter Patch
@remix-run/testing Patch
create-remix Patch
remix Patch
@remix-run/architect Patch
@remix-run/cloudflare Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
@remix-run/css-bundle Patch
@remix-run/deno Patch
@remix-run/eslint-config Patch
@remix-run/express Patch
@remix-run/node Patch
@remix-run/serve Patch
@remix-run/server-runtime Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brophdawg11 brophdawg11 merged commit 3ec5733 into release-next Mar 14, 2025
11 of 13 checks passed
@brophdawg11 brophdawg11 deleted the markdalgleish/guard-remix-virtual-module branch March 14, 2025 13:25
Copy link
Contributor

🤖 Hello there,

We just published version 2.16.1-pre.2 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants