JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q8455F
  • License ISC

Tree-Shakable checker for JavaScript/TypeScript application

Package Exports

  • treeche
  • treeche/lib/main.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (treeche) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Treeche 🌴

What is this

Tree shakable Checker.

check your module is tree-shakable or not, in each module and reduce bundle size!!

Feature ✨

  • typescript support
  • you can check in each file
  • you can check with the unique entrypoint
  • glob pattern support
  • pretty diagnostics report.

How to use 🔧

npm install treeche -D // TBD
treeche "**/*.ts" --excludes "node_modules" "**/*.test.ts"

Example 📕

// this is not tree-shakable because have side-effect

const currentYear = new Date().getFullYear();

export function getCurrentYear() {
    return `Year ${currentYear}`
}
treeche "~~~"

log

🚨 ~/application/side_effect.ts is not tree-shakable due to the following code:

\`\`\`
const currentYear = new Date().getFullYear();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
\`\`\`

if you fix this code such above

// this is tree-shakable because this does not have side-effect

export function getCurrentYear(currentYear: string) {
    return `Year ${currentYear}`
}

log

Congratulation 🎉 All files are tree-shakeable ✨

command 💻

kind name description example
argument inputs input files to check tree-shakable. you can use Node glob pattern treeche "src/**/*.ts"
option excludes excludes files to filter from inputs. you can use Node glob pattern treeche "src/**/*.ts" --e "node_modules"
option entry point the unique entry point to check tree-shakable. if you specify input with this, treeche will bundle so you can check tree-shakable also in node_modules treeche --entry-point ./src/main.ts