Skip to content

Instantly share code, notes, and snippets.

@whilelucky
Last active September 11, 2017 06:54
Show Gist options
  • Save whilelucky/bc4a63c13173a1908c764c67e1fb8df2 to your computer and use it in GitHub Desktop.
Save whilelucky/bc4a63c13173a1908c764c67e1fb8df2 to your computer and use it in GitHub Desktop.
vendor-and-manifest-splitting
//add the webpackManifest and vendor script files to your html
<body>
<div id="root">${app}</div>
<script>window.__INITIAL_STATE__ = ${JSON.stringify(initialState)}</script>
<script src="${assets.webpackManifest.js}"></script>
<script src="${assets.vendor.js}"></script>
<script src="${assets.main.js}"></script>
</body>
import 'redux-pack';
import 'redux-segment';
import 'redux-thunk';
import 'redux';
// import other external dependencies
entry: {
main: './client/index.js',
vendor: './client/vendor.js',
},
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor', 'webpackManifest'],
minChunks: Infinity,
}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment