Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created March 20, 2016 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/a469bd28b425bdf4d054 to your computer and use it in GitHub Desktop.
Save chuck0523/a469bd28b425bdf4d054 to your computer and use it in GitHub Desktop.
var glob = require('glob')
var path = require('path')
var entries = {}
glob.sync("./src/**/entry.js").map(function(file) {
entries[file] = file
})
module.exports = {
entry: entries,
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
}
}
@swingingtom
Copy link

Hey, thanks for this antique gist.
I had to tweak a bit as this as I was using path with ../.
It was outputing in a parent of output.

const entries = {}
glob.sync("../parent-directory/*.js").map(function(file) {
    // be sure to remove path and only keep filename as entryPoint key	
    const entryKey = path.basename(file, '.js');
    entries[entryKey] = file;
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment