From 39eda6aced21b51b488cde18b88789cdcc046e97 Mon Sep 17 00:00:00 2001 From: il3ven Date: Thu, 28 Jul 2022 20:34:39 +0000 Subject: [PATCH] fix import from ES Module The problem was that Node was treating files in dist/esm as CommonJS. The solution would be rename them to .mjs or add a package.json with `type: module`. This commit chooses the second option. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b05cca..567451c 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ ], "scripts": { "lint": "eslint --fix src", - "prepack": "yarn ttsc -p tsconfig.json && ttsc -p tsconfig.cjs.json", + "prepack": "yarn ttsc -p tsconfig.json && echo '{\n\t\"type\": \"module\"\n}' > dist/esm/package.json && ttsc -p tsconfig.cjs.json", "test": "jest src" }, "dependencies": {