-
-
Notifications
You must be signed in to change notification settings - Fork 387
feat(metro-core): support dts-plugin #4449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
62b2a2e
a20d1e1
fc52189
9c9e3c6
14092be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@module-federation/metro': patch | ||
| --- | ||
|
|
||
| Add optional dts-plugin support for Metro remotes. When `dts` is enabled in `withModuleFederation` config, `bundle-mf-remote` can generate `@mf-types.zip` / `@mf-types.d.ts` and will populate `mf-manifest.json` `metaData.types` when those files are produced. | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,11 @@ export interface ModuleFederationConfig | |
| * @deprecated Use runtimePlugins instead. Scheduled for removal in the next major version. | ||
| */ | ||
| plugins?: string[]; | ||
| /** | ||
| * Federated types (d.ts) support. When enabled, Metro bundle commands can | ||
| * generate `@mf-types.zip` and `@mf-types.d.ts` for consumption by hosts. | ||
| */ | ||
| dts?: boolean | moduleFederationPlugin.PluginDtsOptions; | ||
|
||
| } | ||
|
|
||
| export type ShareObject = Record<string, moduleFederationPlugin.SharedConfig>; | ||
|
|
@@ -18,6 +23,7 @@ export interface ModuleFederationConfigNormalized { | |
| shared: ShareObject; | ||
| shareStrategy: moduleFederationPlugin.SharedStrategy; | ||
| plugins: string[]; | ||
| dts: boolean | moduleFederationPlugin.PluginDtsOptions; | ||
| } | ||
|
|
||
| export type ModuleFederationExtraOptions = { | ||
|
|
||
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.
hmmm if this is inside
bundle-remotethen DTS works only when running bundle remote, is this the desired behavior?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.
Yes, intentional for now.
DTS generation here targets remote container build artifacts (
@mf-types.zip,@mf-types.d.ts, andmf-manifest.jsontype metadata), so it is bound tobundle-mf-remote. I made that explicit in9c9e3c644by renaming the helper tomaybeGenerateFederatedRemoteTypesand adding an intent comment at the call site.