Using glob for wilcard support in webpack.config.js
.
const path = require('path');const glob = require("glob");module.exports = { entry: glob.sync("./src/*.js"), output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist'), }};
If your main module require/import other modules, all these modules shall be bundled automatically.
Example index.js
require/import other modules.
var jquery = require('jquery');var util = require('./util.js');
webpack.config.js
.
const path = require('path');module.exports = { entry: path.resolve(__dirname, 'src/index.js'), output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist'), }};