Answer the question
In order to leave comments, you need to log in
How to make dynamic require (webpack)?
Hello.
Unfortunately, the nerves are already at the limit ..... Please, tell me, please ....
There are two entry points:
entry: {
Api : './modules/Api/resources/assets/frontend/app/index',
Test : './modules/Test/resources/assets/frontend/app/index'
},
output: {
path: path.resolve(__dirname, 'public/js'),
filename: '[name].js',
chunkFilename: '[name].js',
publicPath: '/js/'
},
resolve : {
alias : {
Api : path.resolve(__dirname, 'modules/Api/resources/assets/frontend/app/index'),
Test : path.resolve(__dirname, 'modules/Test/resources/assets/frontend/app/index')
}
}
var name = 'Test';
require.ensure([], require => {
require("./" + name);
});
var req = require.context('bundle!./../../../../../', false, /^\.\/.*\.js$/);
req("./" + name + "/resources/assets/frontend/app/require");
require("url?./" + name);
require.ensure([], require => {
require('./../../../../../Test/resources/assets/frontend/app');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question