From 5203871aa848a91d2e55a8dcc41cf19f665911c4 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Wed, 26 Aug 2020 10:58:27 +0200 Subject: [PATCH] Support ESModules --- .gitignore | 1 + package-lock.json | 2 +- package.json | 7 ++++--- src/awaiter.ts | 2 +- src/index.ts | 6 +++--- tsconfig.esm.json | 8 ++++++++ 6 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 tsconfig.esm.json diff --git a/.gitignore b/.gitignore index 88edb62..cccfc87 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ lib/ +es/ diff --git a/package-lock.json b/package-lock.json index 985e21c..fe023cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@hibas123/utils", - "version": "2.2.3", + "version": "2.2.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4e7bffa..cdbed55 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { "name": "@hibas123/utils", - "version": "2.2.6", + "version": "2.2.7", "description": "Different Utilities, that are not worth own packages", "main": "lib/index.js", "types": "lib/index.d.ts", + "module": "es/index.js", "scripts": { - "prepublishOnly": "tsc", - "build": "tsc", + "prepublishOnly": "npm run build", + "build": "tsc && tsc -p tsconfig.esm.json", "watch-ts": "tsc -w" }, "author": "Fabian Stamm ", diff --git a/src/awaiter.ts b/src/awaiter.ts index 90aff1a..abcd4b1 100644 --- a/src/awaiter.ts +++ b/src/awaiter.ts @@ -1,4 +1,4 @@ -import Observable, { ObserverCallback } from "./observable"; +import Observable, { ObserverCallback } from "./observable.js"; export type CheckFunction = (val: T) => boolean; diff --git a/src/index.ts b/src/index.ts index f7e77c3..de7691c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,10 @@ -import Lock, { Release } from "./lock"; +import Lock, { Release } from "./lock.js"; import Observable, { ObserverCallback, ObserverCallbackCollect, ObservableInterface, -} from "./observable"; -import AwaitStore from "./awaiter"; +} from "./observable.js"; +import AwaitStore from "./awaiter.js"; export { Lock, diff --git a/tsconfig.esm.json b/tsconfig.esm.json new file mode 100644 index 0000000..346bc1d --- /dev/null +++ b/tsconfig.esm.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "ESNext", + "moduleResolution": "classic", + "outDir": "es" + } +}