This is a command-line tree-shakability doctor for JavaScript packages. Compared to alternatives, it not only reports whether a package is tree-shakable but also pinpoints the root causes of non-tree-shakability in the JavaScript or TypeScript source.
-
Ensure that your package’s
package.jsonfile specifies"main"or"module". -
If your package is built, enable source-map generation. For TypeScript, this is done via
"sourceMap".
-
If your package is built, run the build step.
-
Run
is-tree-shakablein the package root:npx is-tree-shakable
