Support ESModules

This commit is contained in:
Fabian Stamm 2020-08-26 10:58:27 +02:00
parent 7a649fa1b0
commit 5203871aa8
6 changed files with 18 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules/ node_modules/
lib/ lib/
es/

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@hibas123/utils", "name": "@hibas123/utils",
"version": "2.2.3", "version": "2.2.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,12 +1,13 @@
{ {
"name": "@hibas123/utils", "name": "@hibas123/utils",
"version": "2.2.6", "version": "2.2.7",
"description": "Different Utilities, that are not worth own packages", "description": "Different Utilities, that are not worth own packages",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
"module": "es/index.js",
"scripts": { "scripts": {
"prepublishOnly": "tsc", "prepublishOnly": "npm run build",
"build": "tsc", "build": "tsc && tsc -p tsconfig.esm.json",
"watch-ts": "tsc -w" "watch-ts": "tsc -w"
}, },
"author": "Fabian Stamm <dev@fabianstamm.de>", "author": "Fabian Stamm <dev@fabianstamm.de>",

View File

@ -1,4 +1,4 @@
import Observable, { ObserverCallback } from "./observable"; import Observable, { ObserverCallback } from "./observable.js";
export type CheckFunction<T> = (val: T) => boolean; export type CheckFunction<T> = (val: T) => boolean;

View File

@ -1,10 +1,10 @@
import Lock, { Release } from "./lock"; import Lock, { Release } from "./lock.js";
import Observable, { import Observable, {
ObserverCallback, ObserverCallback,
ObserverCallbackCollect, ObserverCallbackCollect,
ObservableInterface, ObservableInterface,
} from "./observable"; } from "./observable.js";
import AwaitStore from "./awaiter"; import AwaitStore from "./awaiter.js";
export { export {
Lock, Lock,

8
tsconfig.esm.json Normal file
View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "classic",
"outDir": "es"
}
}