fix(nitro): fix regex for tracedFiles scanning (#1509)

This commit is contained in:
Anthony Fu 2021-10-27 18:53:25 +08:00 committed by GitHub
parent 7ede9b14d9
commit 0326a31990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,7 @@ export function externals (opts: NodeExternalsOptions): Plugin {
const pkgs = new Set<string>() const pkgs = new Set<string>()
for (const file of tracedFiles) { for (const file of tracedFiles) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars // 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')) pkgs.add(resolve(baseDir, pkgName, 'package.json'))
} }