tsimportlib
Advanced tools
Comparing version 0.0.4 to 0.0.5
const Module = require('module'); | ||
const {isAbsolute} = require('path'); | ||
const {pathToFileURL} = require('url'); | ||
@@ -9,3 +10,3 @@ exports.dynamicImport = importEsm; | ||
if(isAbsolute(specifier)) { | ||
return import(specifier); | ||
return import(pathToFileURL(specifier).href); | ||
} | ||
@@ -20,2 +21,3 @@ let resolvedPath; | ||
} | ||
resolvedPath = pathToFileURL(resolvedPath).href; | ||
} catch { | ||
@@ -22,0 +24,0 @@ throw new Error(`Unable to locate module "${specifier}" relative to "${module?.filename}" using the CommonJS resolver. Consider passing an absolute path to the target module.`); |
{ | ||
"name": "tsimportlib", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Andrew Bradley", |
3313
39