Answer the question
In order to leave comments, you need to log in
Adding multiple files, entry multiple webpack?
webpackConfig.entry = {
"main": path.resolve(__dirname, 'src/main.js'),
"skin-*": path.resolve(__dirname, 'src/skins/skin-*/main.js') ,
}
there are three folders:
src/skins/skin-1/main.js
src/skins/skin-2/main.js
src/skins/skin-3/main.js Webpack
needs to create the required entryChunkName for each folder and correspondingly, the output was the same. Thank you!
Answer the question
In order to leave comments, you need to log in
Found the answer:
function toObject(paths) {
var ret = {};
paths.forEach(function(path) {
// you can define entry names mapped to [name] here
ret[path.split('/').slice(-2)[0]] = __dirname + "/" + path ;
});
return ret;
}
let entry = Object.assign({}, {"gcore": path.resolve(main, 'src/main.js')}, toObject(glob.sync('src/skin/skin-*/*.js ')))
webpackConfig.entry = entry;
Thanks to all!:)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question