typescript-esm
Tooling to enable interoperability between TypeScript and mjs for Node.js.
Last updated a month ago by kristoferbaxter .
MIT · Original npm · Tarball · package.json
$ cnpm install typescript-esm 
SYNC missed versions from official npm registry.

Typescript ESM

This project aims to make it more straightforward to output valid '.mjs' content from an existing TypeScript Project. All work is done post TypeScript compilation to avoid wrapping the TypeScript API.

Input

tsc -p tsconfig.json

This is likely how you're configuring TypeScript to execute if you're looking at using this package. Right now when using the TypeScript Compiler directly, your output will be '.js' files.

Usage

tsc -p tsconfig.json; tsc-esm -p tsconfig.json

When you add the tsc-esm compiler following the conclusion of TypeScript's output, this compiler will remap all generated files to use '.mjs' extensions for locally resolved items and rename ever output's extension to '.mjs'.

Example

direct.ts in a TypeScript Project.

Before

import {imported} from './imported';

type Bar = string;

export default function() {
  const bar: Bar = 'bar';
  console.log(bar);
  imported();
}

After

import { imported } from './imported.mjs';
export default function () {
  const bar = 'bar';
  console.log(bar);
  imported();
}

Current Tags

  • 1.0.1                                ...           latest (a month ago)

8 Versions

  • 1.0.1                                ...           a month ago
  • 1.0.0                                ...           a month ago
  • 0.0.6                                ...           a month ago
  • 0.0.5                                ...           a month ago
  • 0.0.4                                ...           a month ago
  • 0.0.3                                ...           a month ago
  • 0.0.2                                ...           a month ago
  • 0.0.1                                ...           a month ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |