Conversation
…3d entries Each entry was bundled on its own, so `dist/3d/index.modern.mjs` carried its own copy of every shared module, contexts included. A `Map3D` imported from `/3d` therefore read a different `APIProviderContext` than the `APIProvider` imported from the root and threw "<Map3D> can only be used inside an <APIProvider> component", which is exactly the pairing the map-3d example and the deprecation notices point people at. The root `Pin` likewise could not see a `/3d` `Marker3D`. The ESM output is now one code-split build over all three entries: shared modules land once under `dist/chunks/` and every entry imports the same instance. UMD cannot code-split, so those builds and the per-entry .d.ts files are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
rollup.config.mjsbuilds each entry on its own, sodist/3d/index.modern.mjscarries its own copy of every module it shares with the root, React contexts included. AMap3Dimported from@vis.gl/react-google-maps/3dtherefore reads a differentAPIProviderContextthan theAPIProviderimported from@vis.gl/react-google-maps, and throws:That pairing is exactly what the 1.10.0 deprecation notices and
examples/map-3dpoint people at (the example importsAPIProviderfrom the root andMap3Dfrom/3d). The rootPinlikewise cannot see a/3dMarker3D, because it reads the rootMarker3DContext.Reproduction against the published 1.10.0 package:
Change
The ESM output becomes one code-split build over all three entries (
index,server/index,3d/index): shared modules are emitted once underdist/chunks/and every entry imports the same instance. UMD cannot code-split, so those builds stay self-contained, and the per-entry.d.tsbuilds are unchanged.package.json#filesalready whitelistsdist, so the chunks ship.Built layout:
Verification
Same script as above against the build from this branch:
GoogleMaps3DContext,Marker3DContext,Map3D,Marker3D, andPopoverare identical objects across the two entries, and the rootAPIProvider+/3dMap3Drender.npm testpasses (23 suites),npm run buildproduces the layout above.An app that imports both entries now also loads the shared code once instead of twice.