{"id":22264,"library":"rollup-plugin-tsc-alias","title":"rollup-plugin-tsc-alias","description":"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.","status":"active","version":"1.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/valentiniljaz/rollup-plugin-tsc-alias","tags":["javascript","rollup","plugin","typescript","paths","alias"],"install":[{"cmd":"npm install rollup-plugin-tsc-alias","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-tsc-alias","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-tsc-alias","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Requires Rollup as a peer dependency to function as a plugin.","package":"rollup","optional":false}],"imports":[{"note":"Use default import. CommonJS require works but default import is preferred for ESM modules.","wrong":"const tscAlias = require('rollup-plugin-tsc-alias');","symbol":"default (tscAlias)","correct":"import tscAlias from 'rollup-plugin-tsc-alias';"},{"note":"The package exports a single default function. No named exports.","symbol":"tscAlias","correct":"import tscAlias from 'rollup-plugin-tsc-alias';"},{"note":"Named import syntax is incorrect; the package does not export named symbol 'tscAlias'.","wrong":"import { tscAlias } from 'rollup-plugin-tsc-alias';","symbol":"type: Module","correct":"import tscAlias from 'rollup-plugin-tsc-alias';"}],"quickstart":{"code":"// rollup.config.js\nimport tscAlias from 'rollup-plugin-tsc-alias';\n\nexport default {\n  input: 'src/index.ts',\n  output: {\n    dir: 'dist',\n    format: 'esm',\n  },\n  plugins: [\n    tscAlias({\n      configFile: 'tsconfig.json',\n      watch: false,\n      outDir: undefined,\n      declarationDir: undefined,\n      resolveFullPaths: false,\n      verbose: false,\n    }),\n  ],\n};","lang":"javascript","description":"Basic Rollup configuration integrating rollup-plugin-tsc-alias to resolve TypeScript path aliases in ESM output."},"warnings":[{"fix":"Ensure the TypeScript plugin (e.g., @rollup/plugin-typescript) comes before tscAlias in the plugins array.","message":"Plugin must run after TypeScript compilation. Order matters: place tscAlias after TypeScript plugin in Rollup plugins array.","severity":"gotcha","affected_versions":"*"},{"fix":"Remove the 'silent' option from configuration. Use 'verbose' for output control.","message":"The 'silent' option is deprecated and has no effect since version 1.1.3.","severity":"deprecated","affected_versions":">=1.1.3"},{"fix":"Set resolveFullPaths: true in tscAlias options when using wildcard aliases and targeting ESM format.","message":"If tsconfig.json uses path aliases with wildcards (e.g., '@/*'), resolveFullPaths must be set to true for ESM compatibility.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Verify that tsconfig.json contains correct paths mapping and that the alias matches the import statement exactly.","cause":"tsc-alias cannot find the target module based on the configured path aliases.","error":"Error: Could not resolve import \"...\" in \"...\" (via tsc-alias)"},{"fix":"Ensure configFile option points to a valid tsconfig.json file with compilerOptions.paths defined.","cause":"tsconfig.json file not found or invalid JSON.","error":"TypeError: Cannot read properties of undefined (reading 'compilerOptions')"},{"fix":"Remove the 'silent' key from the options object passed to tscAlias().","cause":"Using the deprecated 'silent' option in plugin configuration.","error":"Warning: The 'silent' option is deprecated and no longer has any effect."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}