Skip to content

An example for developing npm package that supports multiple module format(CommonJS, ESM, UMD)

Notifications You must be signed in to change notification settings

zaki-yama-labs/typescript-npm-package-example

Repository files navigation

TypeScript npm Package Template

A template for developing a npm package that supports multiple module formats (CommonJS, ES Modules and UMD).

File Structure

umd/ // UMD format, bundled JS file
  my-typescript-package.js
esm/ // ES Modules format (`import/export`) JS files
  moduleA.js
  moduleB.js
  index.js
lib/ // CommonJS format (`module.exports/require`) JS files
  moduleA.js
  moduleB.js
  index.js
src/ // Source files written in TypeScript
  moduleA.ts
  moduleB.ts
  index.ts

How to Develop

$ npm install
$ npm run build # generates `lib`, `esm`, and `umd`

About

An example for developing npm package that supports multiple module format(CommonJS, ESM, UMD)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published