DEV Community

SteerClear90
SteerClear90

Posted on

Using vendor chunk file from another application

There is a react project where the vendor and app code are split into separate files upon build.
Can I load this app code js file in another react project (say Project B) using only the Project B's vendor code and not using the vendor file which was generated during the creation of the app code file?
If it is possible I want to understand how the webpack configuration would be like.

Note: I cannot build both project A and project B together in order to get a shared vendor file.

Top comments (1)

Collapse
 
sfleroy profile image
Leroy

That's really not what differential loading is for, and unless your app users exactly the same dependencies, it will not work. I believe webpack does support module federation but the use is slightly different; you need to make shared modules that are in their own package and consume them in both, then it's possible to swap/add onto the already shipped modules.