From 982fd65bd0a25b4e08097e145020acac902516a5 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 12 Oct 2022 10:24:05 -0400 Subject: [PATCH] Fix bundle names for packages under namespaces --- webpack.common.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webpack.common.js b/webpack.common.js index b7c3ad6f4..a19ad0173 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -105,6 +105,14 @@ const config = { // get the name. E.g. node_modules/packageName/not/this/part.js // or node_modules/packageName 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}`; } }