diff --git a/src/index.ts b/src/index.ts index 11b52b3..fe220d6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -71,9 +71,9 @@ export async function resolve( export async function dynamicInstantiate(url: string) { const moduleUrl = new URL(url); - const [nodeModulesBase, specifier] = moduleUrl.pathname.split( - 'node_modules/', - ); + const pathParts = moduleUrl.pathname.split('node_modules/'); + const specifier = pathParts.pop()!; + const nodeModulesBase = pathParts.join('node_modules/'); const nodeModuleUrl = new URL('node_modules', pathToFileURL(nodeModulesBase));