Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
staleGuard
✓ import { staleGuard } from 'tsdown-stale-guard'
✗ const staleGuard = require('tsdown-stale-guard')
Named ESM export only; CJS require() is not supported.
Plugin type
✓ import type { Plugin } from 'tsdown-stale-guard'
TypeScript type import; not a value.
default import
✓ import staleGuard from 'tsdown-stale-guard'
✗ import { staleGuard } from 'tsdown-stale-guard' then using as default
Package has both named and default export for staleGuard; both work, but default import is straightforward.
Basic usage: add staleGuard as a tsdown plugin to validate build freshness.
import { defineConfig } from 'tsdown';
import { staleGuard } from 'tsdown-stale-guard';
export default defineConfig({
plugins: [
staleGuard()
]
});
Debug
Known issues
gotchaPlugin requires tsdown version ^0.21.9 or ^0.22.0. Using other versions may break.fixUpdate tsdown to ^0.21.9 or ^0.22.0.
affects: <0.21.9 || >0.22.0
gotchaStale guard only works if output files are hashed; ensure tsdown config generates hashed filenames.fixEnable hashing in tsdown config (e.g., output.filename with [hash]).
affects: >=0.0.0
gotchaWhen using ESM, default import may not work in some bundlers if they don't support package.json exports field correctly.fixUse named import { staleGuard } instead of default import. affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'tsdown-stale-guard'
Package not installed or not in node_modules
fixRun `npm install tsdown-stale-guard` or `yarn add tsdown-stale-guard`.
ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './package.json' is not defined
Importing an internal path that is not exported
fixOnly import from top-level package: `import { staleGuard } from 'tsdown-stale-guard'`. Audit
Dependencies
tsdownrequiredPeer dependency; plugin runs as part of tsdown build pipeline