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' ;
21import fs from 'fs' ;
32import chalk from 'chalk' ;
43import {
@@ -103,20 +102,6 @@ class ManifestManager {
103102 return sum ;
104103 } , [ ] as ManifestRemote [ ] ) ;
105104
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-
120105 this . _manifest = manifest ;
121106
122107 const manifestFileName = this . fileName ;
Original file line number Diff line number Diff line change 11/* eslint-disable max-lines-per-function */
22/* eslint-disable @typescript-eslint/member-ordering */
33/* eslint-disable max-depth */
4-
4+ import fs from 'fs' ;
5+ import path from 'path' ;
56import {
67 StatsRemote ,
78 StatsBuildInfo ,
@@ -11,6 +12,8 @@ import {
1112 StatsAssets ,
1213 moduleFederationPlugin ,
1314 RemoteEntryType ,
15+ encodeName ,
16+ MFPrefetchCommon ,
1417} from '@module-federation/sdk' ;
1518import {
1619 Compilation ,
@@ -136,6 +139,20 @@ class StatsManager {
136139 pluginVersion : this . _pluginVersion ,
137140 } ;
138141
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+
139156 if ( this . _options . getPublicPath ) {
140157 if ( 'publicPath' in metaData ) {
141158 delete metaData . publicPath ;
You can’t perform that action at this time.
0 commit comments