You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The repo represents simple case - a react app and a library exporting react component.
The app and library are built separately - the intention is that when the lib changes, the app does not need to be rebuilt.
The library is resolved in runtime - not in compile time. I'm using System.js import maps, the lib is externalized in app's webpack config.
This works correctly - the lib code is fetched in runtime, React component can be imported from lib.
The problem is that React library gets duplicated.
I followed the example from webpack docs.
As you can see, in the 'dist' folder, separate chunk for React is created (when compiling app).
This chunk is JSONP webpack chunk.
How to reuse such chunk from the library (separate webpack build)?
Is it possible to configure the format in which the chunks will be emitted?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The repo represents simple case - a react app and a library exporting react component.
The app and library are built separately - the intention is that when the lib changes, the app does not need to be rebuilt.
The library is resolved in runtime - not in compile time. I'm using System.js import maps, the lib is externalized in app's webpack config.
This works correctly - the lib code is fetched in runtime, React component can be imported from lib.
The problem is that React library gets duplicated.
I followed the example from webpack docs.
As you can see, in the 'dist' folder, separate chunk for React is created (when compiling app).
This chunk is JSONP webpack chunk.
How to reuse such chunk from the library (separate webpack build)?
Is it possible to configure the format in which the chunks will be emitted?
Beta Was this translation helpful? Give feedback.
All reactions