Skip to content

Instantly share code, notes, and snippets.

View farsightsoftware's full-sized avatar

T.J. Crowder farsightsoftware

View GitHub Profile
farsightsoftware /
Created September 5, 2023 12:07
Tree shaking example using default export

Quick and dirty project to test the claim default exports defeat tree-shaking. Indicates that no, default exports themselves don't defeat tree-shaking. (An anti-pattern using them would, but not defaults themselves.)

Note: I dislike default exports and strongly recommend not using them when you can avoid them (which is always, other than when interface with some libraries/packages that require them).

To replicate:

  1. Grab these files into a local directory.

  2. Do npm i