How does tree shaking differ between named and default exports?

  • Tree shaking is more effective with default exports
  • Tree shaking is more effective with named exports
  • Tree shaking treats both equally
  • Tree shaking cannot be used with ES6 modules
Tree shaking is more effective with default exports because the bundler can directly eliminate the unused default export, whereas with named exports, the bundler may include unnecessary exports even if only one is used.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *