From 852e87b3346ee8086f6c71a57a824e11fa3e3c21 Mon Sep 17 00:00:00 2001 From: Ryan Roemer Date: Mon, 5 Feb 2018 10:09:09 -0800 Subject: [PATCH] `webpack@4` / `webpack@next` will support `package.json:sideEffects: false` wherein libraries can indicate their ESM re-exports are side effect free and can be much more efficiently removed for smaller, faster final bundles. Lodash has already rolled out this change in https://unpkg.com/lodash-es@4.17.5/package.json ## Issues This was originally uncovered / discussed at length in: * https://github.com/webpack/webpack/issues/1750 This PR should resolve the issues discussed in: * https://github.com/FormidableLabs/victory/issues/549 * https://github.com/FormidableLabs/redux-little-router/issues/262 ## Changes * Add `sideEffects: false` to `package.json` to allow webpack4 tree-shaking to actually remove all unused code. > This PR has been automatically opened by your friendly [`multibot`](https://github.com/FormidableLabs/multibot/). The transform code and documentation is available at: https://github.com/FormidableLabs/multibot-examples/tree/master/transforms/webpack-side-effects --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 841bf62..f517e02 100644 --- a/package.json +++ b/package.json @@ -58,5 +58,6 @@ "peerDependencies": { "react": "^15.0.0-0 || ^16.0.0-0", "react-dom": "^15.0.0-0 || ^16.0.0-0" - } + }, + "sideEffects": false }