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';
|
: 'RemoteEntryModule';
|
||||||
const routeToAdd =
|
const routeToAdd =
|
||||||
hostFederationType === 'dynamic'
|
hostFederationType === 'dynamic'
|
||||||
? `loadRemoteModule('${options.appName}', './${routePathName}')`
|
? `loadRemoteModule('${options.appName.replace(
|
||||||
: `import('${options.appName}/${routePathName}')`;
|
/-/g,
|
||||||
|
'_'
|
||||||
|
)}', './${routePathName}')`
|
||||||
|
: `import('${options.appName.replace(/-/g, '_')}/${routePathName}')`;
|
||||||
|
|
||||||
addRoute(
|
addRoute(
|
||||||
tree,
|
tree,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export function setupTspathForRemote(tree: Tree, options: Schema) {
|
|||||||
|
|
||||||
const exportName = options.standalone ? 'Routes' : 'Module';
|
const exportName = options.standalone ? 'Routes' : 'Module';
|
||||||
|
|
||||||
addTsConfigPath(tree, `${options.appName}/${exportName}`, [
|
addTsConfigPath(tree, `${options.appName.replace(/-/g, '_')}/${exportName}`, [
|
||||||
joinPathFragments(project.root, exportPath),
|
joinPathFragments(project.root, exportPath),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,9 @@ export function setupTspathForRemote(tree: Tree, options: NormalizedSchema) {
|
|||||||
|
|
||||||
const exportName = 'Module';
|
const exportName = 'Module';
|
||||||
|
|
||||||
addTsConfigPath(tree, `${options.projectName}/${exportName}`, [
|
addTsConfigPath(
|
||||||
joinPathFragments(project.root, exportPath),
|
tree,
|
||||||
]);
|
`${options.projectName.replace(/-/g, '_')}/${exportName}`,
|
||||||
|
[joinPathFragments(project.root, exportPath)]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ function handleArrayRemote(
|
|||||||
const remoteLocationExt = extname(remoteLocation);
|
const remoteLocationExt = extname(remoteLocation);
|
||||||
|
|
||||||
// If remote location already has .js or .mjs extension
|
// If remote location already has .js or .mjs extension
|
||||||
if (['.js', '.mjs'].includes(remoteLocationExt)) {
|
if (['.js', '.mjs', '.json'].includes(remoteLocationExt)) {
|
||||||
return remoteLocation;
|
return remoteLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export function mapRemotes(
|
|||||||
} else if (typeof remote === 'string') {
|
} else if (typeof remote === 'string') {
|
||||||
const remoteName = normalizeRemoteName(remote);
|
const remoteName = normalizeRemoteName(remote);
|
||||||
mappedRemotes[remoteName] = handleStringRemote(
|
mappedRemotes[remoteName] = handleStringRemote(
|
||||||
remoteName,
|
remote,
|
||||||
determineRemoteUrl,
|
determineRemoteUrl,
|
||||||
isRemoteGlobal
|
isRemoteGlobal
|
||||||
);
|
);
|
||||||
@ -49,7 +49,7 @@ function handleArrayRemote(
|
|||||||
const remoteLocationExt = extname(remoteLocation);
|
const remoteLocationExt = extname(remoteLocation);
|
||||||
|
|
||||||
// If remote location already has .js or .mjs extension
|
// If remote location already has .js or .mjs extension
|
||||||
if (['.js', '.mjs'].includes(remoteLocationExt)) {
|
if (['.js', '.mjs', '.json'].includes(remoteLocationExt)) {
|
||||||
return remoteLocation;
|
return remoteLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ export function mapRemotesForSSR(
|
|||||||
remoteName = normalizeRemoteName(remoteName);
|
remoteName = normalizeRemoteName(remoteName);
|
||||||
const remoteLocationExt = extname(remoteLocation);
|
const remoteLocationExt = extname(remoteLocation);
|
||||||
mappedRemotes[remoteName] = `${remoteName}@${
|
mappedRemotes[remoteName] = `${remoteName}@${
|
||||||
['.js', '.mjs'].includes(remoteLocationExt)
|
['.js', '.mjs', '.json'].includes(remoteLocationExt)
|
||||||
? remoteLocation
|
? remoteLocation
|
||||||
: `${
|
: `${
|
||||||
remoteLocation.endsWith('/')
|
remoteLocation.endsWith('/')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user