fix(module-federation): ensure mf-manifest supported and tspaths are added with snake_case (#28244)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
39b8a4d990
commit
bb9f209155
@ -166,8 +166,11 @@ function addLazyLoadedRouteToHostAppModule(
|
||||
: 'RemoteEntryModule';
|
||||
const routeToAdd =
|
||||
hostFederationType === 'dynamic'
|
||||
? `loadRemoteModule('${options.appName}', './${routePathName}')`
|
||||
: `import('${options.appName}/${routePathName}')`;
|
||||
? `loadRemoteModule('${options.appName.replace(
|
||||
/-/g,
|
||||
'_'
|
||||
)}', './${routePathName}')`
|
||||
: `import('${options.appName.replace(/-/g, '_')}/${routePathName}')`;
|
||||
|
||||
addRoute(
|
||||
tree,
|
||||
|
||||
@ -12,7 +12,7 @@ export function setupTspathForRemote(tree: Tree, options: Schema) {
|
||||
|
||||
const exportName = options.standalone ? 'Routes' : 'Module';
|
||||
|
||||
addTsConfigPath(tree, `${options.appName}/${exportName}`, [
|
||||
addTsConfigPath(tree, `${options.appName.replace(/-/g, '_')}/${exportName}`, [
|
||||
joinPathFragments(project.root, exportPath),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -11,7 +11,9 @@ export function setupTspathForRemote(tree: Tree, options: NormalizedSchema) {
|
||||
|
||||
const exportName = 'Module';
|
||||
|
||||
addTsConfigPath(tree, `${options.projectName}/${exportName}`, [
|
||||
joinPathFragments(project.root, exportPath),
|
||||
]);
|
||||
addTsConfigPath(
|
||||
tree,
|
||||
`${options.projectName.replace(/-/g, '_')}/${exportName}`,
|
||||
[joinPathFragments(project.root, exportPath)]
|
||||
);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ function handleArrayRemote(
|
||||
const remoteLocationExt = extname(remoteLocation);
|
||||
|
||||
// If remote location already has .js or .mjs extension
|
||||
if (['.js', '.mjs'].includes(remoteLocationExt)) {
|
||||
if (['.js', '.mjs', '.json'].includes(remoteLocationExt)) {
|
||||
return remoteLocation;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ export function mapRemotes(
|
||||
} else if (typeof remote === 'string') {
|
||||
const remoteName = normalizeRemoteName(remote);
|
||||
mappedRemotes[remoteName] = handleStringRemote(
|
||||
remoteName,
|
||||
remote,
|
||||
determineRemoteUrl,
|
||||
isRemoteGlobal
|
||||
);
|
||||
@ -49,7 +49,7 @@ function handleArrayRemote(
|
||||
const remoteLocationExt = extname(remoteLocation);
|
||||
|
||||
// If remote location already has .js or .mjs extension
|
||||
if (['.js', '.mjs'].includes(remoteLocationExt)) {
|
||||
if (['.js', '.mjs', '.json'].includes(remoteLocationExt)) {
|
||||
return remoteLocation;
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ export function mapRemotesForSSR(
|
||||
remoteName = normalizeRemoteName(remoteName);
|
||||
const remoteLocationExt = extname(remoteLocation);
|
||||
mappedRemotes[remoteName] = `${remoteName}@${
|
||||
['.js', '.mjs'].includes(remoteLocationExt)
|
||||
['.js', '.mjs', '.json'].includes(remoteLocationExt)
|
||||
? remoteLocation
|
||||
: `${
|
||||
remoteLocation.endsWith('/')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user