The `rollup-plugin-ts-vue` package, currently at version 0.6.0 (last updated in August 2021), is a Rollup plugin designed to bundle Vue 2 Single-File Components (SFCs) that are written in TypeScript and utilize SCSS for styling. It distinguishes itself by integrating directly with TypeScript's API, aiming to simplify the build process by reducing reliance on external tools such as Babel or Webpack. A key feature is its ability to handle `tsconfig.json` path aliases (e.g., `@/components`), which Rollup typically doesn't resolve by default. The plugin's release cadence is not regular, with its most recent update being driven by security advisories rather than active feature development. It targets a niche of developers who prefer a minimalist Rollup-centric toolchain for their Vue 2 projects with strong TypeScript typing, though it only offers partial support for scoped CSS.
npm install rollup-plugin-ts-vueVerified import paths — ran on the pinned version, not inferred.
This Rollup configuration demonstrates how to bundle a Vue 2 application with TypeScript and SCSS using `rollup-plugin-ts-vue`, resolving node modules and outputting CSS separately.
Thoroughly review the package's dependencies and consider auditing your project for vulnerabilities. Migrate to a more actively maintained solution if security is paramount.
Avoid relying heavily on `scoped` styles or implement alternative CSS scoping strategies (e.g., CSS Modules, BEM methodology, manual class prefixing) if precise isolation is required.
For new projects or projects requiring Vue 3, consider `rollup-plugin-vue` (the official plugin) or solutions based on Vite, which uses Rollup internally, as they offer active maintenance and Vue 3 support.
Ensure `rollup-plugin-ts-vue` is correctly configured in your Rollup plugins array. The plugin is designed to translate and resolve these `tsconfig.json` paths before passing them to Rollup. Your `tsconfig.json` `baseUrl` and `paths` should be correctly set, e.g., `"baseUrl": ".", "paths": { "@/*": [ "src/*" ] }`.While `rollup-plugin-ts-vue` aims to handle this, if encountered, double-check your `tsconfig.json` for any conflicting `include` or `exclude` patterns, and ensure your Rollup configuration's order of plugins is correct. In some cases, `rollup-plugin-typescript2` has been noted as a more robust alternative for complex TypeScript scenarios.