File tree Expand file tree Collapse file tree 5 files changed +16
-5
lines changed
packages/retry-plugin/src Expand file tree Collapse file tree 5 files changed +16
-5
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @module-federation/retry-plugin ' : patch
3
+ ' website-new ' : patch
4
+ ---
5
+
6
+ fix: parameter url for fetch options should not be necessary
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ init({
184
184
// the retry resource url
185
185
url: ' http://localhost:2001/-mf-manifest.json' ,
186
186
// after all retried failed, set a fallback function to guarantee a fallback resource
187
- fallback : () => ' http://localhost:2002/mf-manifest.json' ,
187
+ fallback : (url : string ) => ' http://localhost:2002/mf-manifest.json' ,
188
188
},
189
189
script: {
190
190
// the retry times
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ type FetchWithRetryOptions = {
95
95
options? : RequestInit ;
96
96
retryTimes? : number ;
97
97
retryDelay? : number ;
98
- fallback? : () => string ;
98
+ fallback? : (url : string ) => string ;
99
99
}
100
100
101
101
type ScriptWithRetryOptions = {
Original file line number Diff line number Diff line change 1
- import type { FetchWithRetryOptions } from './types' ;
1
+ import type { RequiredFetchWithRetryOptions } from './types' ;
2
2
import {
3
3
defaultRetries ,
4
4
defaultRetryDelay ,
@@ -12,7 +12,7 @@ async function fetchWithRetry({
12
12
retryTimes = defaultRetries , // retry times
13
13
retryDelay = defaultRetryDelay , // retry delay
14
14
fallback, // fallback url
15
- } : FetchWithRetryOptions ) {
15
+ } : RequiredFetchWithRetryOptions ) {
16
16
try {
17
17
const response = await fetch ( url , options ) ;
18
18
Original file line number Diff line number Diff line change 1
1
export interface FetchWithRetryOptions {
2
- url : string ;
2
+ url ? : string ;
3
3
options ?: RequestInit ;
4
4
retryTimes ?: number ;
5
5
retryDelay ?: number ;
@@ -19,3 +19,8 @@ export type RetryPluginParams = {
19
19
fetch ?: FetchWithRetryOptions ;
20
20
script ?: ScriptWithRetryOptions ;
21
21
} ;
22
+
23
+ export type RequiredFetchWithRetryOptions = Required <
24
+ Pick < FetchWithRetryOptions , 'url' >
25
+ > &
26
+ Omit < FetchWithRetryOptions , 'url' > ;
You can’t perform that action at this time.
0 commit comments