From dc323b9ef2953723ac738e899e2a15f631231b5a Mon Sep 17 00:00:00 2001 From: Piotr Monwid-Olechnowicz Date: Thu, 15 Apr 2021 23:54:29 +0200 Subject: [PATCH] feat(ts-node): register with `module: "commonjs"` Closes #155. --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index f690413..d0d0ec5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,11 @@ import TypeScriptCompileError from './Errors/TypeScriptCompileError'; const loader: Loader = async (filePath: string) => { try { - require('ts-node/register'); + const tsNode = require("ts-node"); + tsNode.register({ + compilerOptions: { module: "commonjs" }, + }); + const result = require(filePath); return get(result, 'default', result);