fix(nitro): fix externals regex for scoped packages

closes #238
This commit is contained in:
Pooya Parsa 2021-07-15 13:08:14 +02:00
parent e1d44262a5
commit 7eecc84f4d

View File

@ -65,7 +65,7 @@ export function externals (opts: NodeExternalsOptions): Plugin {
const pkgs = new Set<string>()
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'))
}