Registry /
devops / rollup-plugin-ts-treeshaking
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import tsTreeshaking from 'rollup-plugin-ts-treeshaking'
✗ const tsTreeshaking = require('rollup-plugin-ts-treeshaking')
ESM-only; package does not export CommonJS.
tsTreeshaking
✓ import tsTreeshaking from 'rollup-plugin-ts-treeshaking'
✗ import { tsTreeshaking } from 'rollup-plugin-ts-treeshaking'
No named export; use default import.
Options
✓ import type { Options } from 'rollup-plugin-ts-treeshaking'
✗ import { Options } from 'rollup-plugin-ts-treeshaking'
Options is a type export, should be used with 'import type'.
Configure Rollup with typescript2 plugin and ts-treeshaking to enable Terser dead code elimination via @__PURE__ annotations.
import typescript from 'rollup-plugin-typescript2';
import tsTreeshaking from 'rollup-plugin-ts-treeshaking';
export default {
input: 'src/index.ts',
output: {
file: 'dist/bundle.js',
format: 'iife',
},
plugins: [
typescript({ useTsconfigDeclarationDir: true }),
tsTreeshaking(),
],
};
Errors
Common errors & fixes
Error: The 'rollup-plugin-ts-treeshaking' plugin is not compatible with Rollup 0.x
Plugin requires Rollup 1.x or higher due to plugin API changes.
fixUpgrade Rollup to version 1.0.0 or higher (npm install rollup@latest).
TypeError: tsTreeshaking is not a function
Using named import instead of default import.
fixUse default import: import tsTreeshaking from 'rollup-plugin-ts-treeshaking'
Cannot find module 'rollup-plugin-ts-treeshaking' or its corresponding type declarations.
Missing @types/rollup-plugin-ts-treeshaking or TypeScript not resolving types.
fixInstall the package normally; it ships its own types. Ensure tsconfig.json includes 'types': ['rollup-plugin-ts-treeshaking'] or uses node module resolution.
Audit
Dependencies
rollup-pluginutilsrequiredused for createFilter and other utilities
rolluprequiredplugin for Rollup bundler (peer dependency)