question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug | Source code is wrongly eliminated during tree-shaking

See original GitHub issue

Do 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:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andreifloricelcommented, Sep 28, 2021

@fkhadra Thank you very much! 😃

0reactions
fkhadracommented, Sep 28, 2021

You solved the issue 😄

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found