Skip to content
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

fix: hotfix manifest #134

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/plugins/pluginMFManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getPreBuildLibImportId, getUsedRemotesMap, getUsedShares } from '../vir

const Manifest = (): Plugin[] => {
const mfOptions = getNormalizeModuleFederationOptions();
const { name, filename, manifest: manifestOptions } = mfOptions;
const { name, filename, getPublicPath, manifest: manifestOptions } = mfOptions;
let mfManifestName: string = '';
if (manifestOptions === true) {
mfManifestName = 'mf-manifest.json';
Expand Down Expand Up @@ -63,6 +63,7 @@ const Manifest = (): Plugin[] => {
types: { path: '', name: '' },
globalName: name,
pluginVersion: '0.2.5',
publicPath,
},
})
);
Expand Down Expand Up @@ -321,6 +322,7 @@ const Manifest = (): Plugin[] => {
},
globalName: name,
pluginVersion: '0.2.5',
...(!!getPublicPath ? { getPublicPath } : { publicPath }),
},
shared,
remotes,
Expand Down
7 changes: 4 additions & 3 deletions src/utils/normalizeModuleFederationOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ export type ModuleFederationOptions = {
>
| undefined;
runtimePlugins?: string[];
publicPath?: string;
getPublicPath?: string;
implementation?: any;
manifest?: ManifestOptions | boolean;
Expand All @@ -269,6 +268,7 @@ export interface NormalizedModuleFederationOptions {
dev?: boolean | PluginDevOptions;
dts?: boolean | PluginDtsOptions;
shareStrategy?: ShareStrategy;
getPublicPath?: string;
}

interface PluginDevOptions {
Expand Down Expand Up @@ -322,9 +322,9 @@ export function getNormalizeShareItem(key: string) {
export function normalizeModuleFederationOptions(
options: ModuleFederationOptions
): NormalizedModuleFederationOptions {
if (options.getPublicPath || options.publicPath) {
if (options.getPublicPath) {
warn(
`We are ignoring the getPublicPath and publicPath options because they are natively supported by Vite\nwith the "experimental.renderBuiltUrl" configuration https://vitejs.dev/guide/build#advanced-base-options`
`We are ignoring the getPublicPath options because they are natively supported by Vite\nwith the "experimental.renderBuiltUrl" configuration https://vitejs.dev/guide/build#advanced-base-options`
);
}
return (config = {
Expand All @@ -342,6 +342,7 @@ export function normalizeModuleFederationOptions(
manifest: normalizeManifest(options.manifest),
dev: options.dev,
dts: options.dts,
getPublicPath: options.getPublicPath,
shareStrategy: options.shareStrategy,
});
}