Ignore Moment.js locales by default (#2187)

* Ignore Moment.js locales by default

* Update README.md
This commit is contained in:
Dan Abramov
2017-05-16 23:59:48 +01:00
committed by GitHub
parent 493e5a6996
commit 65ff5481d9
3 changed files with 39 additions and 0 deletions

View File

@@ -286,6 +286,12 @@ module.exports = {
new ManifestPlugin({
fileName: 'asset-manifest.json',
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
// 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.