Last active
September 19, 2016 22:31
-
-
Save okonet/26b3ac27a605636f39aa to your computer and use it in GitHub Desktop.
Long-term caching with webpack example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var webpack = require('webpack'); | |
var ManifestPlugin = require('webpack-manifest-plugin'); | |
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin'); | |
var WebpackMd5Hash = require('webpack-md5-hash'); | |
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 WebpackMd5Hash(), | |
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