Created
March 11, 2021 16:30
-
-
Save whoisryosuke/e6ba007d6ea47e9aac4839e824ffb93c to your computer and use it in GitHub Desktop.
Babel/Typescript/NPM - How to build CJS, ESM, and Types using Babel and Typescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"build": "concurrently yarn:build:*", | |
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps", | |
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps", | |
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types", | |
"dev": "tsc --watch" | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great job! How did you plan to handle your styles when bundling your code as an ESM?