From d0b383af1786486e1791737df82499aac2c0e1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Connor=20B=C3=A4r?= Date: Mon, 1 Jun 2020 09:23:03 +0200 Subject: [PATCH] chore(configs): compile JSX and add CJS output (#597) * feat(utils): compile JSX * chore(configs): add CJS output --- package.json | 6 +++--- tsconfig.cjs.json | 8 ++++++++ tsconfig.json | 5 ++--- 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 tsconfig.cjs.json diff --git a/package.json b/package.json index c9295343ee..468f17e36b 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "sideEffects": false, "version": "0.0.0-semantically-released", "description": "SumUp's React UI component library", - "main": "dist/index.js", - "module": "dist/index.js", + "main": "dist/cjs/index.js", + "module": "dist/es/index.js", "files": [ "dist", "README.md" @@ -13,7 +13,7 @@ "commit": "git-cz", "start": "start-storybook -p 6006 -s .storybook/public", "dev": "tsc --watch", - "build": "tsc", + "build": "tsc && tsc --project tsconfig.cjs.json", "create:component": "foundry run plop component", "static-styles": "cross-env BABEL_ENV=static babel-node --extensions '.js,.ts,.tsx' ./scripts/static-styles/cli.js", "build:docs": "yarn build:storybook && yarn build:stylesheets", diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000000..8ae595f792 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "target": "es5", + "outDir": "./dist/cjs" + } +} diff --git a/tsconfig.json b/tsconfig.json index 81175fb3b7..a77c3a7485 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,14 +7,13 @@ "declaration": true, "forceConsistentCasingInFileNames": true, "isolatedModules": true, - "jsx": "preserve", - "lib": ["dom", "dom.iterable", "es2017"], + "jsx": "react", "module": "ES2020", "moduleResolution": "node", "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, "noUnusedParameters": true, - "outDir": "./dist", + "outDir": "./dist/es", "resolveJsonModule": true, "skipLibCheck": true, "strict": true,