Skip to content

Demonstrate building an NPM Package that ships both module formats (CJS / ESM) from a TypeScript Codebase

License

Notifications You must be signed in to change notification settings

faselbaum/ts-cjs-esm-package

Repository files navigation

!!! DISCLAIMER !!!

To anyone who might stumble upon this by chance in hopes of a usable template:

The code in this repo doesn't produce any satisfying / usable output yet. The ESM path is still mostly broken and anything that works is currently only tested against node.

ts-cjs-esm-package

Demonstrate building an NPM Package that ships both module formats (CJS / ESM) from a TypeScript Codebase


Repository structure

This repo utilizes npm workspaces. to run any npm script in one of the workspaces from the root dir use:

npm run <script name> --workspace=<workspace / package name>

Prequisites

Take a look into the root package.json's engine field to see what runtime the code is targeting.

Getting started

> npm i
> npm run build
# make sure to build all packages and applications before attempting to start anything

Running the Node Versions

> npm run start

Running the Browser Version

> npm run start:browser

About

Demonstrate building an NPM Package that ships both module formats (CJS / ESM) from a TypeScript Codebase

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published