-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react): add ability to serve remote apps in dev or static mode (#…
- Loading branch information
Showing
12 changed files
with
119 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ExecutorContext } from '@nrwl/devkit'; | ||
import { join } from 'path'; | ||
import { ModuleFederationConfig } from './models'; | ||
|
||
export function loadModuleFederationConfigFromContext( | ||
context: ExecutorContext | ||
): ModuleFederationConfig { | ||
const p = context.workspace.projects[context.projectName]; | ||
const moduleFederationConfigPath = join( | ||
context.root, | ||
p.root, | ||
'module-federation.config.js' | ||
); | ||
|
||
try { | ||
return require(moduleFederationConfigPath) as ModuleFederationConfig; | ||
} catch { | ||
// TODO(jack): Add a link to guide | ||
throw new Error( | ||
`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nrwl/react:host"?` | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export interface SharedLibraryConfig { | ||
singleton: boolean; | ||
strictVersion: boolean; | ||
requiredVersion: string; | ||
eager: boolean; | ||
} | ||
|
||
export type ModuleFederationLibrary = { type: string; name: string }; | ||
|
||
export type Remotes = string[] | [remoteName: string, remoteUrl: string][]; | ||
|
||
export interface ModuleFederationConfig { | ||
name: string; | ||
remotes?: string[]; | ||
library?: ModuleFederationLibrary; | ||
exposes?: Record<string, string>; | ||
shared?: ( | ||
libraryName: string, | ||
library: SharedLibraryConfig | ||
) => undefined | false | SharedLibraryConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ export interface Schema { | |
maxParallel?: number; | ||
withDeps: boolean; | ||
proxyOptions?: object; | ||
watch?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e32932d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev
nx-dev-nrwl.vercel.app