{"id":22265,"library":"rollup-plugin-tsconfig-paths","title":"rollup-plugin-tsconfig-paths","description":"A Rollup plugin that resolves TypeScript path aliases (e.g., \"~/*\") defined in tsconfig.json, enabling cleaner imports in bundled output. Current stable version is 1.5.2, released periodically with minor fixes. It supports Rollup 2, 3, and 4, and ships TypeScript types. Unlike alternatives like @rollup/plugin-alias, this plugin directly reads tsconfig paths, reducing configuration duplication. It can auto-detect tsconfig via TS_NODE_PROJECT env var or cwd search, and offers log level control.","status":"active","version":"1.5.2","language":"javascript","source_language":"en","source_url":"https://github.com/lightyen/typescript-paths","tags":["javascript","rollup","plugin","tsconfig","paths","typescript"],"install":[{"cmd":"npm install rollup-plugin-tsconfig-paths","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-tsconfig-paths","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-tsconfig-paths","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The default export is a factory function. Named export is not available.","wrong":"const { tsConfigPaths } = require('rollup-plugin-tsconfig-paths')","symbol":"default","correct":"import tsConfigPaths from 'rollup-plugin-tsconfig-paths'"},{"note":"Type import in TypeScript; not available as value.","wrong":"import { RollupPluginTsconfigPathsOptions } from 'rollup-plugin-tsconfig-paths'","symbol":"RollupPluginTsconfigPathsOptions","correct":"import type { RollupPluginTsconfigPathsOptions } from 'rollup-plugin-tsconfig-paths'"},{"note":"Call as function, not constructor. Options object is optional.","wrong":"new tsConfigPaths()","symbol":"tsConfigPaths (factory call)","correct":"tsConfigPaths({ tsConfigPath: './tsconfig.app.json' })"}],"quickstart":{"code":"import tsConfigPaths from 'rollup-plugin-tsconfig-paths';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport commonjs from '@rollup/plugin-commonjs';\n\n// tsconfig.json must have paths defined, e.g. \"~/*\": [\"./*\"]\nexport default {\n  input: 'src/index.ts',\n  plugins: [\n    tsConfigPaths({\n      tsConfigPath: './tsconfig.json',\n      logLevel: 'warn'\n    }),\n    nodeResolve({ extensions: ['.ts', '.js'] }),\n    commonjs()\n  ],\n  output: { file: 'dist/bundle.js', format: 'esm' }\n};","lang":"typescript","description":"Shows minimal Rollup config using the plugin with tsconfig path resolution and common plugin chaining."},"warnings":[{"fix":"Order plugins: tsConfigPaths() first, then nodeResolve().","message":"Plugin must come before @rollup/plugin-node-resolve to resolve aliases before Node resolution.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set 'moduleResolution': 'node' in compilerOptions.","message":"tsconfig.json must have \"moduleResolution\": \"node\" for path resolution to work.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use a single tsconfig or merge paths manually.","message":"If multiple tsconfig files are specified, only the first one's paths are used for resolution.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Unset TS_NODE_PROJECT or pass explicit tsConfigPath.","message":"Environment variable TS_NODE_PROJECT overrides the tsConfigPath option if set.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"","message":"No known deprecations as of v1.5.2.","severity":"deprecated","affected_versions":"none"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install the plugin, add to rollup.config.js, ensure tsconfig has paths and baseUrl.","cause":"Plugin not installed, not added to plugins array, or tsconfig paths not configured correctly.","error":"Cannot find module '~/*'"},{"fix":"Use import tsConfigPaths from 'rollup-plugin-tsconfig-paths' (ESM) or const tsConfigPaths = require('rollup-plugin-tsconfig-paths').default (CJS).","cause":"Incorrect import: using named import instead of default.","error":"TypeError: tsConfigPaths is not a function"},{"fix":"Pass a string path or array of strings.","cause":"Passing an object or other type to tsConfigPath.","error":"The 'tsConfigPath' option must be a string or an array of strings"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}