Code splitting boundary within a dependency is ignored? #10084
Unanswered
chuckdries
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We're bundling our react app with parcel. One of our components has a code split boundary in it with React.lazy. We're moving this component out of our app repo into a separate repo, publishing it as a package, and importing it in the exact same place we were importing it before but as a package instead of a file path. The package is also bundled with parcel, with both 'main' and 'module' defined in package.json, and using @parcel/bundler-library.
The issue is: when this component is installed from the package, the code splitting boundary within it isn't respected. The whole package gets included in one bundle, rather than being split along the dynamic import like it was before. How can we ensure that parcel creates separate bundles for the parts of the dependency that we know are behind a lazy load?
I see the note in the docs about dynamic import not being a guarantee. Is there a way to coerce it to work how we want? Or, can we do a manual shared bundle? What would be the specific way to pull that off? I can't seem to target the specific dependency file in manualSharedBundles.root.
If it's relevant, both repos are using yarn 4 pnp.
Beta Was this translation helpful? Give feedback.
All reactions