From 0326a31990f01e5310a71e4e58726e6e137726c1 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 27 Oct 2021 18:53:25 +0800 Subject: [PATCH] fix(nitro): fix regex for tracedFiles scanning (#1509) --- packages/nitro/src/rollup/plugins/externals.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nitro/src/rollup/plugins/externals.ts b/packages/nitro/src/rollup/plugins/externals.ts index 627ce7ae13..20cd72adf3 100644 --- a/packages/nitro/src/rollup/plugins/externals.ts +++ b/packages/nitro/src/rollup/plugins/externals.ts @@ -75,7 +75,7 @@ export function externals (opts: NodeExternalsOptions): Plugin { const pkgs = new Set() for (const file of tracedFiles) { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [_, baseDir, pkgName, _importPath] = /(.+\/node_modules\/)([^@/]+|@[^/]+\/[^/]+)\/(.*)/.exec(file) + const [_, baseDir, pkgName, _importPath] = /^(.+\/node_modules\/)([^@/]+|@[^/]+\/[^/]+)(\/?.*?)?$/.exec(file) pkgs.add(resolve(baseDir, pkgName, 'package.json')) }