Closed natemoo-re closed 3 years ago
Latest commit: 015905af53c1ea522c4f9de80bc23623c66e48f6
The changes in this PR will be included in the next version bump.
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
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/nmoo/microsite/6qZZ5zbd3VJ5em61pWhQVpCeQNW6
✅ Preview: Canceled
[Deployment for 015905a canceled]
🔍 Inspect: https://vercel.com/nmoo/microsite-examples/AntHqpDW1MvVESh7BvP6jEpPxrpN
✅ Preview: https://microsite-examples-git-fix-named-with-hydrate-nmoo.vercel.app
Fixes #147! Also fixed a few other bugs I encountered along the way.
Based on @nikita-graf's awesome suggestion of traversing the AST in a Rollup plugin, except I'm not actually modifying the AST to inject any variables. Instead, a components local
name
is still used as the hydration key (c=InternalComponent
) but the Rollup plugin finds thewithHydrate
HOC calls and emits a JSON file which maps hydration keys (internal Component names) to the exported Component identifiers. This was tested manually against a newnamed-exports
example as well as the existing examples (which all usedexport default withHydrate(Component)
).