File tree Expand file tree Collapse file tree 3 files changed +23
-16
lines changed Expand file tree Collapse file tree 3 files changed +23
-16
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @module-federation/manifest ' : patch
3
+ ---
4
+
5
+ fix(manifest): stats should add prefetchInterface if enable dataPrefetch
Original file line number Diff line number Diff line change 1
- import path from 'path' ;
2
1
import fs from 'fs' ;
3
2
import chalk from 'chalk' ;
4
3
import {
@@ -103,20 +102,6 @@ class ManifestManager {
103
102
return sum ;
104
103
} , [ ] as ManifestRemote [ ] ) ;
105
104
106
- let prefetchInterface = false ;
107
- const prefetchFilePath = path . resolve (
108
- compiler . options . context || process . cwd ( ) ,
109
- `node_modules/.mf/${ encodeName ( stats . name ) } /${ MFPrefetchCommon . fileName } ` ,
110
- ) ;
111
- const existPrefetch = fs . existsSync ( prefetchFilePath ) ;
112
- if ( existPrefetch ) {
113
- const content = fs . readFileSync ( prefetchFilePath ) . toString ( ) ;
114
- if ( content ) {
115
- prefetchInterface = true ;
116
- }
117
- }
118
- stats . metaData . prefetchInterface = prefetchInterface ;
119
-
120
105
this . _manifest = manifest ;
121
106
122
107
const manifestFileName = this . fileName ;
Original file line number Diff line number Diff line change 1
1
/* eslint-disable max-lines-per-function */
2
2
/* eslint-disable @typescript-eslint/member-ordering */
3
3
/* eslint-disable max-depth */
4
-
4
+ import fs from 'fs' ;
5
+ import path from 'path' ;
5
6
import {
6
7
StatsRemote ,
7
8
StatsBuildInfo ,
@@ -11,6 +12,8 @@ import {
11
12
StatsAssets ,
12
13
moduleFederationPlugin ,
13
14
RemoteEntryType ,
15
+ encodeName ,
16
+ MFPrefetchCommon ,
14
17
} from '@module-federation/sdk' ;
15
18
import {
16
19
Compilation ,
@@ -136,6 +139,20 @@ class StatsManager {
136
139
pluginVersion : this . _pluginVersion ,
137
140
} ;
138
141
142
+ let prefetchInterface = false ;
143
+ const prefetchFilePath = path . resolve (
144
+ compiler . options . context || process . cwd ( ) ,
145
+ `node_modules/.mf/${ encodeName ( name ! ) } /${ MFPrefetchCommon . fileName } ` ,
146
+ ) ;
147
+ const existPrefetch = fs . existsSync ( prefetchFilePath ) ;
148
+ if ( existPrefetch ) {
149
+ const content = fs . readFileSync ( prefetchFilePath ) . toString ( ) ;
150
+ if ( content ) {
151
+ prefetchInterface = true ;
152
+ }
153
+ }
154
+ metaData . prefetchInterface = prefetchInterface ;
155
+
139
156
if ( this . _options . getPublicPath ) {
140
157
if ( 'publicPath' in metaData ) {
141
158
delete metaData . publicPath ;
You can’t perform that action at this time.
0 commit comments