JavaScript · Senior · Question 58 of 75

Why might a bundler fail to tree-shake an unused export from a library?

Explanation

Static import/export lets bundlers prove a binding is unused. CommonJS require and top-level side effects (polyfills, global registration) force the module to be kept.

Further reading

Problem with a question

JavaScript · Senior · question 58

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz