plugin-typescript (current stable version 8.0.0) is a loader plugin for SystemJS that enables the direct `System.import` of TypeScript files. It transpiles `.ts` and `.tsx` files on the fly within the browser or Node.js environment when loaded by SystemJS. This package was the officially supported mechanism for transpiling TypeScript within JSPM 0.17.0 and later, providing immediate compilation and error reporting to the console. It supports TypeScript versions 2.0.0 and higher, with specific older versions (4.0.16 for TS 1.8.1, 2.x.x for TS 1.7.5 and below) required for compatibility. The package's release cadence was tied to the evolution of SystemJS and JSPM, focusing on browser-side transpilation and integration with SystemJS's module loading capabilities.
npm install plugin-typescriptVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to configure SystemJS to use `plugin-typescript` for on-the-fly TypeScript transpilation, including mapping paths, setting it as the default transpiler, and applying `typescriptOptions` before importing a TypeScript file.
Ensure `plugin-typescript` and `typescript` peer dependency versions are compatible according to the `plugin-typescript` README. Upgrade or downgrade `plugin-typescript` if needed.
For new projects, consider modern bundlers like Webpack, Rollup, or Vite with their native TypeScript support. For existing projects, be aware of potential unaddressed issues or lack of support for newer TypeScript features.
Always refer to the specific documentation for your SystemJS/JSPM version and `plugin-typescript` version. Ensure `System.config` uses the correct `packages`, `map`, and `transpiler` properties as shown in the `plugin-typescript` README.
Ensure `tsconfig.json` is located in a discoverable path, or explicitly set `tsconfig: 'path/to/tsconfig.json'` in `typescriptOptions` if it's not at the root or standard location.
Verify your `SystemJS.config` map and packages entries for 'ts' and 'typescript' point to the correct paths of the installed modules.
Ensure `jspm install ts` was run (if using JSPM), or that the manual `SystemJS.config` entries for 'ts' (main, map, meta) are correctly specified and point to `plugin-typescript`'s `lib/plugin.js`.
Review the `typescriptOptions` in your `System.config` (or your `tsconfig.json` if `tsconfig: true`) to ensure compiler options like `noImplicitAny`, `strict`, `target`, and `module` are set appropriately for your project and source code.