Skip to content

Instantly share code, notes, and snippets.

@whoisryosuke
Created March 11, 2021 16:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whoisryosuke/e6ba007d6ea47e9aac4839e824ffb93c to your computer and use it in GitHub Desktop.
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
"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"
},
@oyilmaztekin
Copy link

Great job! How did you plan to handle your styles when bundling your code as an ESM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment