Skip to content

Instantly share code, notes, and snippets.

@iilei
Forked from okonet/webpack.config.js
Created December 9, 2015 19:39
Show Gist options
  • Save iilei/09a02f223ced2e67e002 to your computer and use it in GitHub Desktop.
Save iilei/09a02f223ced2e67e002 to your computer and use it in GitHub Desktop.
Long-term caching with webpack example
var path = require('path');
var webpack = require('webpack');
var ManifestPlugin = require('webpack-manifest-plugin');
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
module.exports = {
entry: {
vendor: './src/vendor.js',
main: './src/index.js'
},
output: {
path: path.join(__dirname, 'build'),
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
minChunks: Infinity,
}),
new ManifestPlugin(),
new ChunkManifestPlugin({
filename: "chunk-manifest.json",
manifestVariable: "webpackManifest"
}),
new webpack.optimize.OccurenceOrderPlugin()
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment