@webda/tsc-esm
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

@webda/tsc-esm

This is a wrapper around tsc to compile typescript to esm format without the culprit of having to add '.js' at the end of your import.

When you work with typescript this is valid

import { MyClass } from './myclass';

But the official compiler will generate a file named myclass.js and you will have to write

import { MyClass } from './myclass.js';

This is not really clean in my opinion, so this wrapper will allow you to use the first syntax and will take care of fixing the .js issue for you.

Reference on the famous issue on typescript: https://github.com/microsoft/TypeScript/issues/16577

Usage

You can run the compiler directly with

npx @webda/tsc-esm

Or add it to your project with

# NPM
npm add --dev @webda/tsc-esm
# Yarn
yarn add --dev @webda/tsc-esm
# pnpm
pnpm add --dev @webda/tsc-esm

Update your package.json to add a script

{
  "scripts": {
    "build": "tsc-esm"
  }
}

Readme

Keywords

Package Sidebar

Install

npm i @webda/tsc-esm

Weekly Downloads

47

Version

1.3.0

License

ISC

Unpacked Size

15.4 kB

Total Files

10

Last publish

Collaborators

  • loopingz
  • 8llouch