You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

esm-loader-typescript

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esm-loader-typescript

Chainable ESModule Loader for Typescript

0.0.1
Source
npmnpm
Version published
Weekly downloads
2.3K
26.7%
Maintainers
1
Weekly downloads
 
Created
Source

esm-loader-typescript

Node.js ESModule Loader for importing and loading Typescript (.ts) files and transpiling on the fly.

Warning! Using experimental Node.js features and flags, API will likely change. This may be helpful for development and testing, but should not be used in production.

Usage

npm install --save-dev esm-loader-typescript

We want to import a .ts file with Node.js:

// index.ts
const words: string = 'hello'
console.log(words)
// 'hello'

Standalone

NODE_OPTIONS="--experimental-loader esm-loader-typescript" node index.ts

Chainable

This loader can be configured, and chained with other loaders, using node-esm-loader. This should be your only loader handling Typescript files.

npm install --save-dev node-esm-loader
// .loaderrc.js
export default {
  loaders: ['esm-loader-typescript'],
}
NODE_OPTIONS="--experimental-loader node-esm-loader" node index.ts

Debug

// .loaderrc.js
export default {
  loaders: [
    {
      loader: 'esm-loader-typescript',
      options: {
        debug: true,
      },
    },
  ],
}

License

MIT

Keywords

esm

FAQs

Package last updated on 01 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts