How to add wildcard mapping in entry of webpack

Webpack is expecting a list of files for the entry configuration, not a glob pattern.

You'll have to list the files manually, or automatically with this code snippet

var fs = require('fs'),
    entries = fs.readdirSync('./src/scripts/').filter(function(file) {
        return file.match(/.*\.js$/);
    });

and then pass it to webpack's config.


Having one or few entry points should be enough for most of use cases, but if you really want to bundle up all files from directory you can use following:

As explained here: https://github.com/webpack/webpack/issues/370

var glob = require("glob");
// ...
entry: glob.sync("./src/scripts/*.js")