Skip to content

Instantly share code, notes, and snippets.

@chitoku-k
Last active June 3, 2017 11:22
Show Gist options
  • Save chitoku-k/dbfb3ccd8814905c92c50d429a74eaf1 to your computer and use it in GitHub Desktop.
Save chitoku-k/dbfb3ccd8814905c92c50d429a74eaf1 to your computer and use it in GitHub Desktop.
webpack.config.js
import { path } from 'path';
import { glob } from 'glob';
import { webpack } from 'webpack';
const entries = Object.assign(
...glob.sync('./app/webroot/scripts/js/test/**/entry.js')
.map(file => ({ [ path.basename(path.dirname(file)) ]: file }))
);
console.log(Object.keys(entries))
module.exports = {
entry: entries,
output: {
path: path.join(__dirname, 'app/webroot/dist'),
filename: '[name].js',
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
chunks: Object.keys(entries),
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment