commit 49c7ca4ca8beba4831524797409d35dd7d57aeae
parent 0728df29a7cd36166a3a6565d6e28c411d2bf2e0
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sun, 5 Mar 2017 19:42:46 +0300
[build] pack dependecies to separate chunk
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js
@@ -87,7 +87,7 @@ module.exports = {
'react-native': 'react-native-web'
}
},
-
+
module: {
// First, run the linter.
// It's important to do this before Babel processes the JS.
@@ -115,7 +115,6 @@ module.exports = {
exclude: /augustl\/js-unzip|dankogai\/js-deflate/,
include: paths.appSrc,
loader: 'babel',
-
},
// The notation here is somewhat confusing.
// "postcss" loader applies autoprefixer to our CSS.
@@ -174,7 +173,7 @@ module.exports = {
]
},
-
+
// We use PostCSS for autoprefixing only.
postcss: function() {
return [
@@ -243,7 +242,13 @@ module.exports = {
// having to parse `index.html`.
new ManifestPlugin({
fileName: 'asset-manifest.json'
- })
+ }),
+ new webpack.optimize.CommonsChunkPlugin({
+ name: 'vendor',
+ minChunks: function(module, count) {
+ return module.resource && (/node_modules|vendored/).test(module.resource)
+ }
+ }),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.