Created
October 12, 2017 20:44
Sample of Pinterest Mweb webpack configuration
This file contains hidden or 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
const bundles = { | |
'vendor-mweb': [ | |
'app/mobile/polyfills.js', | |
'intl', | |
'normalizr', | |
'react-dom', | |
'react-redux', | |
'react-router-dom', | |
'react', | |
'redux' | |
], | |
'entryChunk-webpack': 'app/mobile/runtime.js', | |
'entryChunk-mobile': 'app/mobile/index.js' | |
}; | |
const chunkPlugins = [ | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor-mweb', | |
minChunks: Infinity, | |
chunks: ['entryChunk-mobile'] | |
}), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'entryChunk-webpack', | |
minChunks: Infinity, | |
chunks: ['vendor-mweb'] | |
}), | |
new webpack.optimize.CommonsChunkPlugin({ | |
children: true, | |
name: 'entryChunk-mobile', | |
minChunks: (module, count) => { | |
return module.resource && (isCommonLib(resource) || count >= 3); | |
} | |
}) | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @zackargyle,
I'm trying to create bundles of my vendor dependencies in WebPack and found your gist.
Could you please explain:
There's no reference to this on the CommonChunkPlugin. Do you use this to create entry points?
isCommonLib
function)Thanks in advance