hoist-non-react-statics icon indicating copy to clipboard operation
hoist-non-react-statics copied to clipboard

Improved tree shaking in the library by adding sideEffects = false

Open Tom910 opened this issue 5 years ago • 4 comments

We can hel webpack remove code if we mark package without side effects - https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free

Tom910 avatar Feb 21 '20 07:02 Tom910

Coverage Status

Coverage remained the same at 88.05% when pulling cd7e7b44f9a1de79ebcfc334768b7fc53857993c on Tom910:improve-tree-shaking into 3b8def968f74b10adbc8c66b8babc0e0c6390a64 on mridgway:master.

coveralls avatar Feb 21 '20 07:02 coveralls

Coverage Status

Coverage remained the same at 88.05% when pulling cd7e7b44f9a1de79ebcfc334768b7fc53857993c on Tom910:improve-tree-shaking into 3b8def968f74b10adbc8c66b8babc0e0c6390a64 on mridgway:master.

coveralls avatar Feb 21 '20 07:02 coveralls

Probably won't work without this https://github.com/mridgway/hoist-non-react-statics/pull/86

TrySound avatar Feb 21 '20 07:02 TrySound

Probably won't work without this

Yes, you right it changes don't work for webpack 4. But if we used webpack 5 work fine. I create a repo for testing tree shaking - https://github.com/Tom910/webpack-tree-shaking-commonjs-mix

With sideEffect=false with-sideEffect

Without sideEffect without-sideEffect

Tom910 avatar Feb 21 '20 08:02 Tom910