{"id":22261,"library":"rollup-plugin-ts-paths","title":"rollup-plugin-ts-paths","description":"A Rollup plugin (v1.0.5) that resolves TypeScript path aliases defined in tsconfig.json to their actual file paths during bundling. It allows developers to use TypeScript's paths feature with Rollup, enabling clean imports like `import { Foo } from 'foo'` which maps to a source file path. The plugin is lightweight, has no external runtime dependencies, and must be placed before other Rollup plugins like commonjs to ensure correct resolution. However, it only supports the first entry in a paths array, and it is primarily useful for projects that first compile with tsc and then bundle with Rollup. The package ships TypeScript types and is maintained on GitHub.","status":"active","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/bitshiftza/rollup-plugin-ts-paths","tags":["javascript","rollup","plugin","typescript","paths"],"install":[{"cmd":"npm install rollup-plugin-ts-paths","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-ts-paths","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-ts-paths","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export; named import does not exist. ESM-only; CommonJS require must use default import pattern.","wrong":"const { tsConfigPaths } = require('rollup-plugin-ts-paths')","symbol":"default","correct":"import tsConfigPaths from 'rollup-plugin-ts-paths'"},{"note":"TypeScript users can import the Options type for configuration. Not exported as runtime value.","wrong":"","symbol":"TypeScript type: Options","correct":"import type { Options } from 'rollup-plugin-ts-paths'"}],"quickstart":{"code":"// rollup.config.js\nimport tsConfigPaths from 'rollup-plugin-ts-paths';\nimport commonjs from '@rollup/plugin-commonjs';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\n\nexport default {\n  input: 'src/index.ts',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    tsConfigPaths(),   // Must come before other resolvers\n    nodeResolve(),\n    commonjs()\n  ]\n}","lang":"typescript","description":"Basic Rollup config using rollup-plugin-ts-paths to resolve TypeScript path aliases, placed before nodeResolve and commonjs plugins."},"warnings":[{"fix":"Ensure the first path entry is the intended one, or avoid using multiple fallback paths.","message":"Plugin only resolves the first entry in a tsconfig paths array; subsequent entries are ignored.","severity":"gotcha","affected_versions":"<=1.0.5"},{"fix":"Order the plugin first in the plugins array.","message":"Place before other Rollup plugins that resolve imports (like nodeResolve or commonjs), otherwise paths may not be resolved.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure tsconfig.json exists in the project root or specify tsConfigDirectory option.","message":"Requires tsconfig.json to be present; does not support jsconfig.json or alternative config files.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure tsConfigPaths() is first in plugins array and that foo is defined in tsconfig.json paths.","cause":"Plugin not placed before other resolvers or tsconfig paths not configured correctly.","error":"Error: Cannot find module 'foo'"},{"fix":"Use `import tsConfigPaths from 'rollup-plugin-ts-paths'`.","cause":"Using named import instead of default import.","error":"TypeError: tsConfigPaths is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}