-
-
Save iilei/09a02f223ced2e67e002 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'); | |
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