0.0.3 • Published 6 years ago

@mothepro/ts-module-shim v0.0.3

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
6 years ago

TS Module Shim

Extends the 'es-module-shim' module to support TypeScript files

This should really only be used for development purposes.

TypeScript compiler is large (8 Mb) and performance expensive.

How to Use

<!-- Include the usual es-module-shim. -->
<script type="module" src="//unpkg.com/es-module-shims@0.4.6/dist/es-module-shims.min.js"></script>

<!-- Include typescript and this module -->
<script src="//unpkg.com/typescript@3.7.4/lib/typescript.js"></script>
<script type="module" src="//unpkg.com/@mothepro/ts-module-shim/dist/esm/index.js"></script>

<!-- Then include your typescript file as a shim -->
<script dev-only type="module-shim" src="index.ts"></script>

TODO

  • Properly handle typescript file extnesions
  • Conditionally load Typescript
    • Import Typescript compiler within this module.
    • Require only one module to be leaded in the HTML
  • Better source map suppoert
  • Support custom tsconfig files
    • Support the extends field used in some TSConfigs
  • Add tests