Last active
November 14, 2021 17:47
-
-
Save jherax/458a2a271152bd05cb35c5845059f9df to your computer and use it in GitHub Desktop.
Load multiple entries in webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var glob = require('glob'); | |
module.exports = { | |
entry: toObject(glob.sync('assets/**/*.js*')), | |
output: { | |
filename: '[name].js' | |
}, | |
//... | |
}; | |
function toObject(paths) { | |
var names = {}; | |
paths.forEach(function(path) { | |
// you can define entry names mapped to [name] here | |
names[path.split('/').slice(-1)[0]] = path; | |
}); | |
return names; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment