Skip to content

Instantly share code, notes, and snippets.

@adewalegeorge
Forked from prateekbh/sample webpack
Created September 29, 2016 07:39
Show Gist options
  • Save adewalegeorge/b9528b8f93f561924de243c6eba0d0ac to your computer and use it in GitHub Desktop.
Save adewalegeorge/b9528b8f93f561924de243c6eba0d0ac to your computer and use it in GitHub Desktop.
var CommonsPlugin = new require("webpack/lib/optimize/CommonsChunkPlugin");
var webpack = new require("webpack");
module.exports = {
entry: {
home: "./scripts/home.js",
apis: "./scripts/api.js",
app: "./scripts/app.js",
vendor: "./scripts/vendor.js"
},
module:{
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a valid name to reference
query: {
presets: ['es2015']
}
},
{
test: /\.tag$/,
loader: 'tag'
}
]
},
plugins: [
new CommonsPlugin({
minChunks: Infinity,
name: "vendor"
})
],
output: {
// Make sure to use [name] or [id] in output.filename
// when using multiple entry points
filename: "./build/[name].bundle.js",
chunkFilename: "[id].bundle.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment