How do I split code for my application using webpack?

Viewed 10

I have a React application (called MyApp) which has a dependency (called Dep, also in React). I own both the applications.

In Dep, I have used dynamic imports at multiple places for lazy loading. I build it using rollup, and the code is properly split as I want it to. I then create an npm package and use it as a dependency in MyApp.

Now I build MyApp using webpack, but the issue is that webpack bundles everything in Dep. I want it to still remain split so that I can load my webpages faster.

What am I doing wrong?

0 Answers
Related