From 436ac8382df709faa0fa7ab61936496385d25cb4 Mon Sep 17 00:00:00 2001 From: Stephen Hanson Date: Fri, 12 May 2023 09:47:59 -0500 Subject: [PATCH] Run ts-node with esm loader This fixes the issue where we are unable to run packages that only export ES Modules. It's possible we will still run into some issues with this configuration since ESM support is still experimental on the TypeScript side. Relevant issue: https://github.com/TypeStrong/ts-node/issues/1007 ESM loader docs: https://typestrong.org/ts-node/docs/imports/#native-ecmascript-modules --- package.json | 1 + tsconfig.json | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index f499106..c1a1a44 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.0", "description": "Monorepo for project bootstrapping CLIs", "main": "index.js", + "type": "module", "scripts": { "belt": "bin/belt", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/tsconfig.json b/tsconfig.json index 678fd00..d945246 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "allowSyntheticDefaultImports": true, "target": "es2019", - "module": "commonjs", + "module": "ES2020", "moduleResolution": "node", "strict": true, "sourceMap": true, @@ -10,5 +10,9 @@ "skipLibCheck": true, "types": ["node"] }, + "ts-node": { + "esm": true, + "experimentalSpecifierResolution": "node" + }, "include": ["./**/*"] }