remix icon indicating copy to clipboard operation
remix copied to clipboard

WIP: vite-plugin-react-swc integration

Open pcattori opened this issue 1 year ago • 3 comments

See https://github.com/vitejs/vite-plugin-react-swc/pull/191

pcattori avatar Mar 20 '24 17:03 pcattori

⚠️ No Changeset found

Latest commit: cef3e66cad89e31b5550b1c3ab51fbb311251353

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

changeset-bot[bot] avatar Mar 20 '24 17:03 changeset-bot[bot]

For React plugin to function correctly, we need to only create ?client-route virtual modules in production, not in development. Currently, the React plugin will only add React Refresh header/footer to files that define React components (which is correct), but the virtual modules re-export React components defined in their corresponding route modules. We used to manually inject React Refresh header/footer for these vmods too when we vendored/modified the React plugin.

?client-route vmods exist solely to guarantee same production-mode treeshaking from classic (esbuild-based) Remix compiler still happens when migrating to Remix Vite. Originally, I was opposed to having ?client-route vmods exist only in the prod module graph, but since they exist solely to power optimizations like treeshaking that only get applied in prod, its ok for that part of the module graph to be different. Especially since these vmods are one-liners that just re-export client-safe exports, so there isn't a bunch of complexity that could trip us up.

pcattori avatar Mar 25 '24 18:03 pcattori

@pcattori I've merged main into this PR with https://github.com/remix-run/remix/pull/9395 so usage of ?client-route=1 has been removed in dev.

markdalgleish avatar May 09 '24 03:05 markdalgleish

This cleanup will be in RRv7, so no need to force it into Remix at the moment

pcattori avatar Sep 06 '24 17:09 pcattori