Registry / devops / rollup-plugin-dts-path-alias

rollup-plugin-dts-path-alias

JSON →
library0.0.3jsnpmunverified

A Rollup plugin that resolves TypeScript path aliases and baseUrl in .d.ts files, converting them to relative paths. Current version 0.0.3 (2024), stable but early-stage. Designed for individual .ts file builds (not bundled .d.ts). Key differentiator: works with @rollup/plugin-typescript, not rollup-plugin-dts. Supports monorepos and auto-discovers tsconfig.json. Helps ensure type declaration portability across projects.

npm install rollup-plugin-dts-path-alias
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-DTS-
R
rollup-plugin-dts-path-alias
devopsjavascriptv0.0.3
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import dtsPathAlias from 'rollup-plugin-dts-path-alias'
✗ const dtsPathAlias = require('rollup-plugin-dts-path-alias')
ESM-only; does not export a named export. Use default import. CommonJS require will fail.
dtsPathAlias
✓ import dtsPathAlias from 'rollup-plugin-dts-path-alias'
✗ import { dtsPathAlias } from 'rollup-plugin-dts-path-alias'
The plugin is default-exported. Named import { dtsPathAlias } is incorrect.
dtsPathAlias (type)
✓ import type { Plugin } from 'rollup'; import dtsPathAlias from 'rollup-plugin-dts-path-alias'
The plugin does not export a TypeScript type; use Rollup's Plugin type if needed.

Typical Rollup config using @rollup/plugin-typescript and dtsPathAlias to compile TypeScript and resolve path aliases in .d.ts files.

import typescript from '@rollup/plugin-typescript'; import dtsPathAlias from 'rollup-plugin-dts-path-alias'; export default { input: 'src/index.ts', output: { dir: 'dist', format: 'es', }, plugins: [ dtsPathAlias(), typescript(), ], };
Debug
Known issues
breakingPlugins order matters: dtsPathAlias() must be placed before typescript() to apply transformations on emitted .d.ts files.
fix
Place dtsPathAlias() before typescript() in the plugins array.
affects: >=0.0.1
gotchaDoes not work with rollup-plugin-dts (rollup-plugin-dts bundles .d.ts). Use with @rollup/plugin-typescript or similar.
fix
Use @rollup/plugin-typescript for individual file builds.
affects: >=0.0.1
deprecatedNo deprecated features in version 0.0.3.
fix
No action needed.
affects: 0.0.3
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-dts-path-alias'
Package not installed or import path incorrect.
fix
npm install rollup-plugin-dts-path-alias --save-dev
TypeError: dtsPathAlias is not a function
Named import used instead of default import.
fix
import dtsPathAlias from 'rollup-plugin-dts-path-alias';
Error: Could not find tsconfig.json
tsconfig.json not found in cwd or parent directories.
fix
Ensure tsconfig.json exists or provide cwd option.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
rollup-plugin-dts-path-alias — npm install rollup-plugin-dts-path-alias · libregistry