@@ -26,24 +26,27 @@ const fixFetchWorkerPaths = (filePath, publicPath) => {
26
26
}
27
27
28
28
const content = fs . readFileSync ( filePath , 'utf8' ) ;
29
-
29
+
30
30
// Replace relative "chunks/" paths with absolute paths including publicPath
31
31
const fixedContent = content . replace (
32
32
/ r e t u r n " c h u n k s \/ " \+ " f e t c h - w o r k e r " / g,
33
33
`return "${ publicPath } chunks/" + "fetch-worker"`
34
+ ) . replace (
35
+ / [ = ] > " c h u n k s \/ f e t c h - w o r k e r \. / g,
36
+ `=>"${ publicPath } chunks/fetch-worker.`
34
37
) ;
35
38
36
- if ( content !== fixedContent ) {
39
+ if ( content === fixedContent ) {
40
+ console . info ( `No fetch-worker paths found in ${ path . relative ( basePath , filePath ) } ` ) ;
41
+ } else {
37
42
fs . writeFileSync ( filePath , fixedContent ) ;
38
43
console . info ( `Fixed fetch-worker paths in ${ path . relative ( basePath , filePath ) } ` ) ;
39
- } else {
40
- console . info ( `No fetch-worker paths found in ${ path . relative ( basePath , filePath ) } ` ) ;
41
44
}
42
45
} ;
43
46
44
- const postbuild = async ( ) => {
47
+ const postbuild = ( ) => {
45
48
const publicPath = process . env . PUBLIC_PATH ;
46
-
49
+
47
50
if ( ! publicPath ) {
48
51
console . info ( 'PUBLIC_PATH not set - skipping fetch-worker path fixes' ) ;
49
52
return ;
@@ -63,13 +66,6 @@ const postbuild = async () => {
63
66
}
64
67
} ;
65
68
66
- postbuild ( ) . then (
67
- ( ) => {
68
- console . info ( 'Post-build script complete' ) ;
69
- process . exit ( 0 ) ;
70
- } ,
71
- e => {
72
- console . error ( 'Post-build script failed:' , e ) ;
73
- process . exit ( 1 ) ;
74
- }
75
- ) ;
69
+ postbuild ( ) ;
70
+ console . info ( 'Post-build script complete' ) ;
71
+ process . exit ( 0 ) ;
0 commit comments