Bug | Source code is wrongly eliminated during tree-shaking
See original GitHub issueDo you want to request a feature or report a bug? Bug
What is the current behavior? Parts of react-toastify sources are wrongly treated as dead-code and eliminated during tree-shaking.
Ex: the imported eventManager has side-effects and it should NOT be eliminated. But this happens because currently only CSS files are marked as having side-effects: https://github.com/fkhadra/react-toastify/blob/v8.0.2/package.json#L20
What is the expected behavior?
A simple&quick solution would be to mark the library as having side-effects (in package.json):
"sideEffects":true,
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
webpack@4 Tree Shaking doesn't eliminate code between ...
webpack@4 Tree Shaking doesn't eliminate code between multiple entry points in same configuration object. #4453.
Read more >Bug | Source code is wrongly eliminated during tree-shaking
Bug | Source code is wrongly eliminated during tree-shaking ; Do you want to request a feature or report a bug? Bug ;...
Read more >Tree shaking and code splitting in webpack
Tree shaking, also known as dead code elimination, is the practice of removing unused code in your production build.
Read more >Tree-shaking in real world: what could go wrong?
Tree-shaking is the process of detecting and marking dead code in your bundle based on ES modules' usage of import and export statements....
Read more >rollup changelog
Do not change logic when tree-shaking declarations in if statements ... Fix an issue where code after a switch-statement with removed cases ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fkhadra Thank you very much! 😃
You solved the issue 😄