From c13f3a6085d63c274ff938706cf90188da0fa38f Mon Sep 17 00:00:00 2001 From: Martin Malfertheiner Date: Tue, 20 Apr 2021 10:14:21 +0200 Subject: [PATCH] create commonjs build for SSR projects --- package.json | 5 ++++- tsconfig.esnext.json | 13 +++++++++++++ tsconfig.json | 1 - 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tsconfig.esnext.json diff --git a/package.json b/package.json index 83bf887..bee6522 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,12 @@ "license": "MIT", "private": false, "main": "dist/index.js", + "module": "dist/esm/index.js", "typings": "dist/index.d.ts", "scripts": { - "build": "tsc", + "build": "npm run build:node && npm run build:esm", + "build:node": "tsc", + "build:esm": "tsc --project tsconfig.esnext.json", "lint": "eslint --ext js,ts,tsx src", "lint:fix": "npm run lint -- --fix", "test": "jest --config jestconfig.json --passWithNoTests", diff --git a/tsconfig.esnext.json b/tsconfig.esnext.json new file mode 100644 index 0000000..7fae2da --- /dev/null +++ b/tsconfig.esnext.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "declaration": true, + "outDir": "./dist/esm", + "strict": true, + "esModuleInterop": true + }, + "include": ["src"], + "exclude": ["node_modules", "**/__test__/*", "**/__tests__/*"] +} diff --git a/tsconfig.json b/tsconfig.json index a2f8c69..84b9879 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "target": "es5", - "module": "esnext", "moduleResolution": "node", "declaration": true, "outDir": "./dist",