Skip to content

Commit db11904

Browse files
committed
fix: type
1 parent 07388ce commit db11904

File tree

5 files changed

+99
-99
lines changed

5 files changed

+99
-99
lines changed

packages/bridge/bridge-react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
"vite": "^5.4.18",
123123
"vite-plugin-dts": "^4.3.0",
124124
"@module-federation/runtime": "workspace:*",
125+
"@module-federation/runtime-core": "workspace:*",
125126
"hono": "3.12.12"
126127
}
127128
}

packages/bridge/bridge-react/src/lazy/data-fetch/prefetch.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
getDataFetchMap,
55
getDataFetchMapKey,
66
} from '../utils';
7+
import logger from '../logger';
78
import helpers from '@module-federation/runtime/helpers';
89
import { DataFetchParams } from '../types';
910

@@ -17,17 +18,20 @@ export type PrefetchOptions = {
1718
export async function prefetch(options: PrefetchOptions) {
1819
const { instance, id, dataFetchParams, preloadComponentResource } = options;
1920
if (!id) {
20-
throw new Error('id is required for prefetch!');
21+
logger.error('id is required for prefetch!');
22+
return;
2123
}
2224
if (!instance) {
23-
throw new Error('instance is required for prefetch!');
25+
logger.error('instance is required for prefetch!');
26+
return;
2427
}
2528
const matchedRemoteInfo = helpers.utils.matchRemoteWithNameAndExpose(
2629
instance.options.remotes,
2730
id,
2831
);
2932
if (!matchedRemoteInfo) {
30-
throw new Error(`Can not found '${id}' in instance.options.remotes!`);
33+
logger.error(`Can not found '${id}' in instance.options.remotes!`);
34+
return;
3135
}
3236
const { remote, expose } = matchedRemoteInfo;
3337
const { remoteSnapshot, globalSnapshot } =

packages/bridge/bridge-react/src/plugins/lazy-load-component-plugin.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '../lazy';
1111
import type { CreateLazyComponentOptions, PrefetchOptions } from '../lazy';
1212

13-
declare module '@module-federation/runtime' {
13+
declare module '@module-federation/runtime-core' {
1414
interface FederationHost {
1515
createLazyComponent<T, E extends keyof T>(
1616
options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>,
@@ -49,16 +49,6 @@ export function lazyLoadComponentPlugin(): FederationRuntimePlugin {
4949
});
5050
};
5151

52-
instance.wrapNoSSR = (fn) => {
53-
return (options) => {
54-
return fn({
55-
instance,
56-
noSSR: true,
57-
...options,
58-
});
59-
};
60-
};
61-
6252
instance.collectSSRAssets = (options) => {
6353
return collectSSRAssets({
6454
instance,

packages/sdk/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export {
77
simpleJoinRemoteEntry,
88
inferAutoPublicPath,
99
} from './generateSnapshotFromManifest';
10-
export * from './logger';
10+
export { logger, createLogger } from './logger';
11+
export type { Logger } from './logger';
1112
export * from './env';
1213
export * from './dom';
1314
export * from './node';

0 commit comments

Comments
 (0)