Registry / web-framework / plugin-typescript

plugin-typescript

JSON →
library8.0.0jsnpmunverified

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-typescript
INSTALL
IMPORT
SIG · PLUGIN-TYPESCRIPT
P
plugin-typescript
web-frameworkjavascriptv8.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Transpiler Configuration
System.config({ transpiler: "ts", packages: { "app": { "defaultExtension": "ts" } } });
This configures SystemJS to use `plugin-typescript` as the default transpiler for `.js` and `.ts` files within the 'app' package.
Package-Specific Loader
System.config({ transpiler: "babel", // Use another transpiler by default packages: { "src": { "defaultExtension": "ts", "meta": { "*.ts": { "loader": "ts" } } } } });
This pattern configures `plugin-typescript` to load specific files (e.g., all `.ts` files in the 'src' package) even if a different default transpiler is set.
TypeScript Compiler Options
System.config({ typescriptOptions: { module: "system", noImplicitAny: true, tsconfig: true } });
Passes TypeScript compiler options directly to the underlying TypeScript compiler used by the plugin. These options can also be overridden for specific files using `meta` configuration.

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 'typescript' is installed as a peer dependency: npm install typescript@^2.4.0 If using JSPM: jspm install ts Otherwise, configure SystemJS manually: */ SystemJS.config({ packages: { "ts": { "main": "lib/plugin.js" }, "typescript": { "main": "lib/typescript.js", "meta": { "lib/typescript.js": { "exports": "ts" } } }, "app": { "defaultExtension": "ts" } }, map: { // Adjust these paths to your installation location "ts": "./node_modules/plugin-typescript", "typescript": "./node_modules/typescript" }, transpiler: 'ts', typescriptOptions: { module: "system", target: "es5", emitDecoratorMetadata: true, experimentalDecorators: true, noImplicitAny: false } }); // Example app.ts content (assuming this file exists): // export class MyClass { constructor(public name: string) {} } // console.log(new MyClass('Hello from TypeScript!')); System.import('app/main.ts') // Assuming main.ts is the entry point within the 'app' package .then(module => { console.log('Successfully loaded and transpiled main.ts', module); // You can now interact with exports from main.ts }) .catch(err => console.error('Error loading TypeScript module:', err));
Debug
Known issues
breakingMajor TypeScript version compatibility: plugin-typescript 8.x requires TypeScript 2.0.0+. Older versions of `plugin-typescript` (4.0.16 or 2.x.x) are necessary for TypeScript 1.8.1 and below, respectively.
fix
Ensure `plugin-typescript` and `typescript` peer dependency versions are compatible according to the `plugin-typescript` README. Upgrade or downgrade `plugin-typescript` if needed.
affects: <8.0.0
gotchaThe package is effectively abandoned. The last major update was in 2017 (v8.0.0), and it relies heavily on SystemJS and JSPM, which are less commonly used in modern web development workflows. No further updates or bug fixes are expected.
fix
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.
affects: >=8.0.0
breakingConfiguration structure for SystemJS changed across major versions of SystemJS and JSPM. Older configuration styles might not work, especially with how packages and transpilers are defined.
fix
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.
affects: <8.0.0
gotchaResolving `tsconfig.json` path: When `tsconfig: true` is set, `plugin-typescript` attempts to resolve `tsconfig.json` using SystemJS's normal resolution. Incorrect paths or configurations can lead to compiler options not being applied.
fix
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.
affects: >=2.0.0
Errors
Common errors & fixes
Error: (SystemJS) X not found.
SystemJS failed to find `plugin-typescript` or `typescript` due to incorrect `map` or `packages` configuration.
fix
Verify your `SystemJS.config` map and packages entries for 'ts' and 'typescript' point to the correct paths of the installed modules.
Error: transpiler set to 'ts', however System.import('ts') failed.
SystemJS could not load the `plugin-typescript` module itself, often due to missing installation or incorrect configuration.
fix
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`.
TypeScript compile error: Supplied parameters do not match any signature of call target.
This is a general TypeScript compilation error indicating a type mismatch or incorrect usage, but it can be exacerbated by incorrect `typescriptOptions` or `tsconfig.json` settings.
fix
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.
Upgrade
Version history
8.0.0latest on npm
Audit
Dependencies
typescriptrequiredRequired peer dependency for the actual TypeScript compilation process.
Agent activity
30 hits · last 30 days
node
26
Amazon
1
OpenAI (training)
1
Resources