vite-plugin-typescript-transform is a Vite plugin designed to integrate the full TypeScript compiler into the Vite build transform phase. Its primary purpose is to enable advanced TypeScript features, such as the new ECMAScript decorators, that Vite's default transpiler, esbuild, might not yet support. The plugin operates by transpiling code using the TypeScript compiler before esbuild processes it, allowing developers to leverage the latest TypeScript syntax without waiting for esbuild updates. Currently at version 1.3.1, the package demonstrates active maintenance with several releases in the past year addressing bug fixes and feature enhancements, such as improved tsconfig parsing. It functions as an augmentation to Vite's pipeline, rather than a replacement, and requires careful configuration of plugin order to ensure correct operation.
npm install vite-plugin-typescript-transformVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to configure the plugin in `vite.config.ts` to apply TypeScript transformation, specifically highlighting the use of `enforce: 'pre'` and `tsconfig.override` for features like ECMAScript decorators.
Refer to the plugin's documentation for any specific migration paths when upgrading from 1.x to future major versions.
Always include `enforce: 'pre'` in the plugin configuration within your `vite.config.ts` file.
Carefully consider your `tsconfig` options (especially `target`) within the `tsconfig.override` to produce output compatible with esbuild and your target runtime environment.
Upgrade to `v1.3.1` or later to ensure proper handling of `tsconfig.json` extends and `tsconfig.override` functionality. If unable to upgrade, flatten your `tsconfig.json` or manually apply all relevant compiler options.
Ensure `vite-plugin-typescript-transform` is installed, correctly imported, and configured with `enforce: 'pre'` in your `vite.config.ts`. Additionally, set appropriate TypeScript `target` and `compilerOptions` (e.g., for new decorators, `"target": "ES2021"` or higher in `tsconfig.override`).
Verify that `enforce: 'pre'` is set in the plugin configuration. Check the `filter` options to ensure the correct file types (e.g., `.ts` files) are being included for transformation. Review `tsconfig.override` for desired `compilerOptions`.
Upgrade to `vite-plugin-typescript-transform` version 1.3.0 or higher, which introduced support for the `extends` property in `tsconfig.json`.