Registry / devops / application-typescript

application-typescript

JSON →
library1.0.2jsnpmunverified

A browser-only loader that allows running TypeScript files directly from script tags with `type="application/typescript"` and `src` attribute, without any build step or bundler. It transpiles TypeScript on-the-fly in the browser using esm.sh for the TypeScript compiler and rewrites import specifiers to blob URLs. Ideal for small prototypes (up to 10–15 components) and quick experiments. Not suitable for production apps due to CDN dependency, lack of tree-shaking, and SSR. Current stable version is 1.0.2. Releases are infrequent. Key differentiator: zero configuration and no build tools, relying on CDN-based compilation via esm.sh.

npm install application-typescript
INSTALL
IMPORT
SIG · APPLICATION-TYPESC
A
application-typescript
devopsjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

application-typescript runner (entry point)
<script type="module" src="https://esm.sh/application-typescript"></script>
<script src="https://esm.sh/application-typescript"></script> (missing type="module")
The runner must be loaded as an ES module. Placing it before the application/typescript markers will cause it to miss those scripts.
import map
<script type="importmap">...</script>
<script type="application/typescript">...</script> (wrong type)
Import maps must have type="importmap". The runner merges all import maps on the page, but overrides scopes with a warning.
TypeScript file (entry marker)
<script type="application/typescript" src="./hello.ts"></script>
<script type="text/typescript" src="./hello.ts"></script> (wrong MIME type) or <script type="application/typescript"></script> without src (ignored)
The `src` attribute is required. Relative paths are resolved against the page URL.

HTML page that loads a TypeScript file directly via a script tag and runs it in the browser using the application-typescript runner from esm.sh.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Hello</title> </head> <body> <div id="app"></div> <script type="application/typescript" src="./hello.ts"></script> <script type="module" src="https://esm.sh/application-typescript"></script> </body> </html>
Debug
Known issues
breakingRunner script must come AFTER all `<script type="application/typescript">` markers. If placed before, the initial DOM query will miss them and those TS files will not execute.
fix
Ensure the runner `<script type="module" src="https://esm.sh/application-typescript"></script>` appears after all application/typescript markers in the HTML.
affects: >=1.0
gotchaDoes not work with `file://` protocol. `import` and `fetch` are blocked due to CORS and module security restrictions.
fix
Serve your files over HTTP (e.g., `npx serve .`).
affects: >=1.0
gotchaBare imports (e.g., `import { html } from "htm/preact/standalone"`) automatically resolve to `https://esm.sh/` but only if no import map overrides them. This may break in environments blocking CDN traffic.
fix
Add an import map to pin versions or use a different CDN. Example: `{"imports":{"htm/preact/standalone":"https://esm.sh/htm@3.1.1/preact/standalone"}}`
affects: >=1.0
deprecatedThe package has not been updated since v1.0.2 (June 2024). It depends on esm.sh service stability.
fix
Monitor esm.sh availability or switch to a bundler for production.
affects: >1.0.2
gotchaImport map `scopes` are ignored and a warning is logged. Only top-level `imports` are merged.
fix
Flatten scoped imports into the top-level `imports` object.
affects: >=1.0
Errors
Common errors & fixes
Error: [ERR_MODULE_NOT_FOUND] Cannot find module '...' imported from '...'
The relative import path in a .ts file is incorrect or the file wasn't fetched (e.g., due to 404 or CORS).
fix
Check that the import specifier starts with './' or '../' and that the file exists at the expected URL relative to the importing module.
TypeError: Failed to fetch dynamically imported module: https://esm.sh/application-typescript
The runner script URL is incorrect or the CDN (esm.sh) is unreachable.
fix
Verify the URL in the script tag. Alternatively, use 'https://unpkg.com/application-typescript' as fallback.
Uncaught SyntaxError: The requested module '...' does not provide an export named '...'
A named import does not match any export from the module, or the module is not the expected version.
fix
Use an import map to pin versions, and verify the export name matches the module's actual exports.
application-typescript: import map scopes are not supported, skipping
The library logs this warning when an import map contains a `scopes` property, which is ignored.
fix
Remove the `scopes` property from the import map and move all mappings to the top-level `imports`.
Cannot use import statement outside a module
The runner script tag is missing `type="module"`, so ES module imports are not recognized.
fix
Add `type="module"` to the script tag loading the runner: `<script type="module" src="https://esm.sh/application-typescript"></script>`
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
typescriptoptionalBrowser-side transpilation relies on fetching TypeScript compiler from esm.sh. No npm dependency, but runtime CDN dependency.
Agent activity
17 hits · last 30 days
node
12
OpenAI (training)
2
Amazon
1
Resources
application-typescript — npm install application-typescript · libregistry