Skip to content

Instantly share code, notes, and snippets.

@AaronFlower
Created December 11, 2017 15:05
Show Gist options
  • Save AaronFlower/8538883ee86f500a2e905f6ff8ca0f48 to your computer and use it in GitHub Desktop.
Save AaronFlower/8538883ee86f500a2e905f6ff8ca0f48 to your computer and use it in GitHub Desktop.
webpack-config-optimize
const path = require('path')
const webpack = require('webpack')
const htmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
app: './src/main.js',
moduleA: './src/moduleA.js',
moduleB: './src/moduleB.js',
moduleC: './src/moduleC.js'
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].js'
},
plugins: [
new htmlWebpackPlugin({
title: 'Webpack CommonsChunkPlugin'
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'self.lodash.vendor',
chunks: ['moduleA', 'moduleB']
})
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment