When you simply use require
, the webpack compiles all your modules into a single javascript file, and according to the module size (+ dependencies) this file will be large. So if it is a web application and the user is on a slow internet logically the application should take a while to start for the first time.
To solve this the webpack has the Code Spitting feature ( link ) where when you use the function import()
it splits its modules into small files that are loaded only when needed. This way your build gets smaller, so your application starts faster.
For Vue.js there are Dynamic and Asynchronous Components ( link ) .