If you’re not sure if you understand it correctly, you can refer to it. First of all, webpack packaging can package js into independent files, so who is still not together. Secondly, load some js modules by using asynchronous loading in main.js. At this time, you will usually get two or more js files after packaging. One is required for the homepage, and the other js is loaded when it is loaded into the corresponding module or page. Hope this helps
Entry sets multiple entry files and packages them into multiple
require.ensure to separate modules that need to be loaded asynchronously on demand
If you’re not sure if you understand it correctly, you can refer to it.
First of all, webpack packaging can package js into independent files, so who is still not together.
Secondly, load some js modules by using asynchronous loading in main.js.
At this time, you will usually get two or more js files after packaging. One is required for the homepage, and the other js is loaded when it is loaded into the corresponding module or page.
Hope this helps
If you use the latest Webpack2, the specification document recommends using
import
替换过时的require.ensure
.Officially also recommended to use
bundle-loader
I didn’t test the first one successfully, but the second one works.
There are multiple entrances in the entry, I will show you the screenshot and you will understand