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.
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.
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.