How to reuse vendor chunk from separate webpack build?

Viewed 129

The repo represents simple case - 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?

Can such chunk be consumed by System.js ?

0 Answers
Related