I have an application that uses Webpack and now I want to do the following:
There is a folder with several resources:
resources
├── A.json
├── B.json
└── C.json
I would like to load one of them dynamically:
function getResource(name, callback) {
require(['./resources' + name + '.json'], function(resource) {
callback(resource);
});
}
That works fine for me, expect that all my resources bundled into the single 1.js file, but I'd like to split them and load only one on demand.
How can I do it with webpack?