Skip to content

Commit

Permalink
fix(bundling): get workspace package prefix length correctly #20817
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Jul 24, 2024
1 parent 15b71d0 commit e143b13
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,16 @@ require('${mainFile}');
}

function getPrefixLength(pattern: string): number {
return pattern.substring(0, pattern.indexOf('*')).length;
const prefixIfWildcard = pattern.substring(0, pattern.indexOf('*')).length;
const prefixWithoutWildcard = pattern.substring(
0,
pattern.lastIndexOf('/')
).length;
// if the pattern doesn't contain '*', then the length is always 0
// This causes issues when there are sub packages such as
// @nx/core
// @nx/core/testing
return prefixIfWildcard || prefixWithoutWildcard;
}

function getTsConfigCompilerPaths(context: ExecutorContext): {
Expand Down

0 comments on commit e143b13

Please sign in to comment.