Skip to content

Commit

Permalink
fix(react): ensure module federation template files are indented corr…
Browse files Browse the repository at this point in the history
…ectly (#28753)

<!-- 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 #
  • Loading branch information
Coly010 authored Nov 1, 2024
1 parent 80ef3ee commit 4f4b546
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { loadRemote } from '@module-federation/enhanced/runtime';
<%_ if (remotes.length > 0) {
remotes.forEach(function(r) { _%>
<%_ if (dynamic) { _%>
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
<%_ } else { _%>
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
<%_ } _%>
<%_ }); _%>
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<%_ if (dynamic) { _%>
import { init } from '@module-federation/enhanced/runtime';
import { init } from '@module-federation/enhanced/runtime';

fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then((remotes: Record<string, string>) =>
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
)
.then((remotes) => init({ name: '<%= projectName %>', remotes }))
.then(() => import('./bootstrap').catch(err => console.error(err)));
fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then((remotes: Record<string, string>) =>
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
)
.then((remotes) => init({ name: '<%= projectName %>', remotes }))
.then(() => import('./bootstrap').catch(err => console.error(err)));
<%_ } else { _%>
import('./bootstrap').catch(err => console.error(err));
import('./bootstrap').catch(err => console.error(err));
<%_ } _%>
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { loadRemote } from '@module-federation/enhanced/runtime';
<%_ if (remotes.length > 0) {
remotes.forEach(function(r) { _%>
<%_ if (dynamic) { _%>
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
<%_ } else { _%>
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
<%_ } _%>
<%_ }); _%>
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<%_ if (dynamic) { _%>
import { init } from '@module-federation/enhanced/runtime';
import { init } from '@module-federation/enhanced/runtime';

fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then((remotes: Record<string, string>) =>
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
)
.then((remotes) => init({ name: '<%= projectName %>', remotes }))
.then(() => import('./bootstrap').catch(err => console.error(err)));
fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then((remotes: Record<string, string>) =>
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
)
.then((remotes) => init({ name: '<%= projectName %>', remotes }))
.then(() => import('./bootstrap').catch(err => console.error(err)));
<%_ } else { _%>
import('./bootstrap').catch(err => console.error(err));
import('./bootstrap').catch(err => console.error(err));
<%_ } _%>
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { loadRemote } from '@module-federation/enhanced/runtime';
<%_ if (remotes.length > 0) {
remotes.forEach(function(r) { _%>
<%_ if (dynamic) { _%>
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
const <%= r.className %> = React.lazy(() => loadRemote('<%= r.fileName %>/Module') as any)
<%_ } else { _%>
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
<%_ } _%>
<%_ }); _%>
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<%_ if (dynamic) { _%>
import { init } from '@module-federation/enhanced/runtime';
import { init } from '@module-federation/enhanced/runtime';

fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then((remotes: Record<string, string>) =>
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
)
.then((remotes) => init({ name: '<%= projectName %>', remotes }))
.then(() => import('./bootstrap').catch(err => console.error(err)));
fetch('/assets/module-federation.manifest.json')
.then((res) => res.json())
.then((remotes: Record<string, string>) =>
Object.entries(remotes).map(([name, entry]) => ({ name, entry }))
)
.then((remotes) => init({ name: '<%= projectName %>', remotes }))
.then(() => import('./bootstrap').catch(err => console.error(err)));
<%_ } else { _%>
import('./bootstrap').catch(err => console.error(err));
import('./bootstrap').catch(err => console.error(err));
<%_ } _%>

0 comments on commit 4f4b546

Please sign in to comment.