From 660d5032f3ece0aff390d99a4412a2849e1b7c21 Mon Sep 17 00:00:00 2001 From: David Kudera Date: Thu, 25 Jun 2020 15:41:41 +0200 Subject: [PATCH] Build CommonJs and ESM versions --- package.json | 12 ++++++------ tsconfig.cjs.json | 7 +++++++ tsconfig.json | 8 ++++---- 3 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 tsconfig.cjs.json diff --git a/package.json b/package.json index 2b8eeee..03a52e0 100755 --- a/package.json +++ b/package.json @@ -19,17 +19,17 @@ "url": "git@github.com:davidkudera/google-maps-loader.git" }, "license": "MIT", - "main": "./lib/index.js", - "types": "./lib/index.d.ts", + "main": "./lib/cjs/index.js", + "types": "./lib/types/index.d.ts", + "module": "./lib/esm/index.js", "dependencies": { "@types/googlemaps": "^3.39.1" }, "devDependencies": { - "@types/node": "^13.1.6", - "typescript": "^3.7.4" + "@types/node": "^14.0.14", + "typescript": "^3.9.5" }, "scripts": { - "build": "tsc", - "watch": "tsc --watch" + "build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json" } } diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000..4926708 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "./lib/cjs" + } +} diff --git a/tsconfig.json b/tsconfig.json index 916f8ca..27c4fb0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", + "target": "ES2017", + "module": "ES2020", "sourceMap": true, "declaration": true, - "outDir": "./lib" + "outDir": "./lib/esm", + "declarationDir": "./lib/types" }, "include": [ "./src"