@aacc/tsc-js
v0.0.2
Published
Example hybrid ESM/CJS JavaScript build with TSC
Downloads
7
Readme
Initialize project
npm init
Install typescript
npm i -D typescript
Install typescript configs
npm i -D @aacc/tsconfigs
Setup TypeScript configs
Reference local configs:
tsconfig.json
serves as the base for both module outputstsconfig-esm.json
extends base and is used build to the ESM outputtsconfig-cjs.json
extends base and is used to build to CJS output
Configure package.json
Reference local package.json, specify:
main
,module
, andtypes
keys- conditional
exports
key build
,add-build-pkgs
, andtype-check
scripts
References:
- https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html
- https://antfu.me/posts/publish-esm-and-cjs
TODO:
- Read up on pre/post NPM scripts: https://docs.npmjs.com/cli/v8/using-npm/scripts