1

My question is are the node modules dependencies are lazy loaded in any way? or it's just the magic of imports?

As I have built a git submodule and doing Lazy Loading using react-loadable but it hardly seems to work.

Prabhat Mishra
  • 951
  • 2
  • 12
  • 33

1 Answers1

0

Node_Modules are not lazy loaded. Here you are using react-loadable which is nothing but a dynamic import in JS/JSX file. Whenever webpack finds the import statement in js file it will create the chunk file and reference will be added to the main js file. In browser network tab you can see the multiple files.

react-loadable is useful for large scale project, where it will has multiple pages. That time it is not a good practice to bundle all js into single file. In that case react-loadable create multiple chunks and loaded whenever the components needs to be present in the screen.

Srigar
  • 1,648
  • 3
  • 14
  • 28
  • yeah `webpack` creates a junk but these junks never gets picked up when i use in the main application. Refer this https://stackoverflow.com/questions/58256536/unhandled-rejection-chunkloaderror-loading-chunk-1-failed – Prabhat Mishra Oct 06 '19 at 15:22