How to lazy load a large JS import?


One of our app uses some large libraries like three.js, moment etc and it all gets compiled as one large vendor.js which has all the node_modules packed together. And this massive .js is loaded at app launch (at least with v3, I wonder if this changed with v4).

Is there a way import these large libraries such that they are lazy loaded when needed - which in our case will be right after the first page is displayed and becomes interactive. A solution that works with either v3 or v4 will help.