Skip to content

Commit

Permalink
fix(angular): fix wrong trailing comma in mf bootstrap code generation (
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez authored Feb 5, 2024
1 parent 48296b0 commit 0421178
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`Init MF --federationType=dynamic should create a host with the correct
fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then(definitions => setRemoteDefinitions(definitions))
.then(() => import('./bootstrap').catch(err => console.error(err));)"
.then(() => import('./bootstrap').catch(err => console.error(err)));"
`;

exports[`Init MF --federationType=dynamic should create a host with the correct configurations when --typescriptConfiguration=true 1`] = `
Expand All @@ -15,7 +15,7 @@ exports[`Init MF --federationType=dynamic should create a host with the correct
fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then(definitions => setRemoteDefinitions(definitions))
.then(() => import('./bootstrap').catch(err => console.error(err));)"
.then(() => import('./bootstrap').catch(err => console.error(err)));"
`;

exports[`Init MF should add a remote application and add it to a specified host applications router config 1`] = `
Expand Down
6 changes: 3 additions & 3 deletions packages/angular/src/generators/setup-mf/lib/fix-bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ export function fixBootstrap(tree: Tree, appRoot: string, options: Schema) {
tree.write(joinPathFragments(appRoot, 'src/bootstrap.ts'), bootstrapCode);
}

const bootstrapImportCode = `import('./bootstrap').catch(err => console.error(err));`;
const bootstrapImportCode = `import('./bootstrap').catch(err => console.error(err))`;

const fetchMFManifestCode = `import { setRemoteDefinitions } from '@nx/angular/mf';
fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then(definitions => setRemoteDefinitions(definitions))
.then(() => ${bootstrapImportCode})`;
.then(() => ${bootstrapImportCode});`;

tree.write(
mainFilePath,
options.mfType === 'host' && options.federationType === 'dynamic'
? fetchMFManifestCode
: bootstrapImportCode
: `${bootstrapImportCode};`
);
}

Expand Down

0 comments on commit 0421178

Please sign in to comment.