Merge pull request #4031 from thornbill/namespace-bundles

Fix bundle names for packages under namespaces
This commit is contained in:
Bill Thornton 2022-10-12 10:39:08 -04:00 committed by GitHub
commit 58d506c75d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -105,6 +105,14 @@ const config = {
// get the name. E.g. node_modules/packageName/not/this/part.js // get the name. E.g. node_modules/packageName/not/this/part.js
// or node_modules/packageName // or node_modules/packageName
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1]; const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
// if "packageName" is a namespace (i.e. @jellyfin) get the namespace + packageName
if (packageName.startsWith('@')) {
const parts = module.context
.substring(module.context.lastIndexOf(packageName))
.split('/');
return `node_modules.${parts[0]}.${parts[1]}`;
}
return `node_modules.${packageName}`; return `node_modules.${packageName}`;
} }
} }