Correct me if I'm wrong, but what webpack does is bundle up all your files into one and then serves them to the client to reduce requests. Afterwards, the client still has to load that file for your app to work, so in order to make it faster, code splitting lets the client loads up different parts of your app on demand, correct?
I'm not sure how to do that with the below code from the docs. So if I put the below code in a file that has already been loaded, the first parameter refer to the dependencies and the 2nd refer to the callback. That means anything I want to do with the dependencies have to go in the callback, correct?
require.ensure(["module-a", "module-b"], function() {
var a = require("module-a");
// ...
});