From abeb0cef1c9844f004ddd0f5a7c740d9d12fff85 Mon Sep 17 00:00:00 2001 From: Junxiao Shi Date: Sat, 25 Apr 2020 13:36:18 -0400 Subject: [PATCH] fix(dynamicInstantiate): works with pnpm --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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));