Comparing version 0.1.3 to 0.1.4
@@ -21,3 +21,2 @@ /* eslint-disable */ | ||
function register(options) { | ||
var _a; | ||
const transformOptions = { | ||
@@ -38,3 +37,2 @@ target: `node${process.versions.node.split(".")[0]}`, | ||
extensions[".js"] = function (module, filename) { | ||
var _a; | ||
try { | ||
@@ -46,3 +44,4 @@ return js(module, filename); | ||
(e.code === "ERR_REQUIRE_ESM" || | ||
((_a = e.message) === null || _a === void 0 ? void 0 : _a.includes("Cannot use import statement outside a module")))) { | ||
e.message?.includes("Cannot use import statement outside a module") || | ||
e.message?.includes("Unexpected token 'export'"))) { | ||
return esbuild$1(module, filename); | ||
@@ -53,3 +52,3 @@ } | ||
}; | ||
(_a = extensions[".mjs"]) !== null && _a !== void 0 ? _a : (extensions[".mjs"] = function (module, filename) { | ||
extensions[".mjs"] ?? (extensions[".mjs"] = function (module, filename) { | ||
return esbuild$1(module, filename); | ||
@@ -56,0 +55,0 @@ }); |
{ | ||
"name": "esm-hook", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"main": "register.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
8566
64