Registry / devops / rollup-plugin-tsc-alias

rollup-plugin-tsc-alias

JSON →
library1.1.4jsnpmunverified

A Rollup plugin that replaces TypeScript path aliases with relative paths after compilation using tsc-alias. Version 1.1.4 is the latest stable release. It integrates seamlessly into Rollup's build pipeline, reading aliases from tsconfig.json and rewriting import paths in the output bundle. Unlike manual path resolution, this plugin automates the mapping of TypeScript paths (e.g., @/components) to relative paths, ensuring compatibility with CommonJS and ESM output. It supports watch mode, custom config file paths, and options for declaration directories. The plugin is lightweight, with only Rollup as a peer dependency, and is actively maintained.

npm install rollup-plugin-tsc-alias
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-TSC-
R
rollup-plugin-tsc-alias
devopsjavascriptv1.1.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

default (tscAlias)
import tscAlias from 'rollup-plugin-tsc-alias';
const tscAlias = require('rollup-plugin-tsc-alias');
Use default import. CommonJS require works but default import is preferred for ESM modules.
tscAlias
import tscAlias from 'rollup-plugin-tsc-alias';
The package exports a single default function. No named exports.
type: Module
import tscAlias from 'rollup-plugin-tsc-alias';
import { tscAlias } from 'rollup-plugin-tsc-alias';
Named import syntax is incorrect; the package does not export named symbol 'tscAlias'.

Basic Rollup configuration integrating rollup-plugin-tsc-alias to resolve TypeScript path aliases in ESM output.

// rollup.config.js import tscAlias from 'rollup-plugin-tsc-alias'; export default { input: 'src/index.ts', output: { dir: 'dist', format: 'esm', }, plugins: [ tscAlias({ configFile: 'tsconfig.json', watch: false, outDir: undefined, declarationDir: undefined, resolveFullPaths: false, verbose: false, }), ], };
Debug
Known issues
gotchaPlugin must run after TypeScript compilation. Order matters: place tscAlias after TypeScript plugin in Rollup plugins array.
fix
Ensure the TypeScript plugin (e.g., @rollup/plugin-typescript) comes before tscAlias in the plugins array.
affects: *
deprecatedThe 'silent' option is deprecated and has no effect since version 1.1.3.
fix
Remove the 'silent' option from configuration. Use 'verbose' for output control.
affects: >=1.1.3
gotchaIf tsconfig.json uses path aliases with wildcards (e.g., '@/*'), resolveFullPaths must be set to true for ESM compatibility.
fix
Set resolveFullPaths: true in tscAlias options when using wildcard aliases and targeting ESM format.
affects: *
Errors
Common errors & fixes
Error: Could not resolve import "..." in "..." (via tsc-alias)
tsc-alias cannot find the target module based on the configured path aliases.
fix
Verify that tsconfig.json contains correct paths mapping and that the alias matches the import statement exactly.
TypeError: Cannot read properties of undefined (reading 'compilerOptions')
tsconfig.json file not found or invalid JSON.
fix
Ensure configFile option points to a valid tsconfig.json file with compilerOptions.paths defined.
Warning: The 'silent' option is deprecated and no longer has any effect.
Using the deprecated 'silent' option in plugin configuration.
fix
Remove the 'silent' key from the options object passed to tscAlias().
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies
rolluprequiredRequires Rollup as a peer dependency to function as a plugin.
Agent activity
8 hits · last 30 days
node
7
OpenAI (training)
1
Resources
rollup-plugin-tsc-alias — npm install rollup-plugin-tsc-alias · libregistry