@@ -83,9 +83,32 @@ export class NextFederationPlugin {
83
83
} ) ;
84
84
} ,
85
85
} ) ;
86
- const runtimeESMPath = require . resolve (
87
- '@module-federation/runtime/dist/index.esm.js' ,
88
- ) ;
86
+
87
+ const noop = this . getNoopPath ( ) ;
88
+
89
+ if ( ! this . _extraOptions . skipSharingNextInternals ) {
90
+ compiler . hooks . make . tapAsync (
91
+ 'NextFederationPlugin' ,
92
+ ( compilation , callback ) => {
93
+ const dep = compiler . webpack . EntryPlugin . createDependency (
94
+ noop ,
95
+ 'noop' ,
96
+ ) ;
97
+ compilation . addEntry (
98
+ compiler . context ,
99
+ dep ,
100
+ { name : 'noop' } ,
101
+ ( err , module ) => {
102
+ if ( err ) {
103
+ return callback ( err ) ;
104
+ }
105
+ callback ( ) ;
106
+ } ,
107
+ ) ;
108
+ } ,
109
+ ) ;
110
+ }
111
+
89
112
if ( ! compiler . options . ignoreWarnings ) {
90
113
compiler . options . ignoreWarnings = [
91
114
//@ts -ignore
@@ -171,16 +194,7 @@ export class NextFederationPlugin {
171
194
const defaultShared = this . _extraOptions . skipSharingNextInternals
172
195
? { }
173
196
: retrieveDefaultShared ( isServer ) ;
174
- const noop = this . getNoopPath ( ) ;
175
197
176
- const defaultExpose = this . _extraOptions . skipSharingNextInternals
177
- ? { }
178
- : {
179
- './noop' : noop ,
180
- './react' : require . resolve ( 'react' ) ,
181
- './react-dom' : require . resolve ( 'react-dom' ) ,
182
- './next/router' : require . resolve ( 'next/router' ) ,
183
- } ;
184
198
return {
185
199
...this . _options ,
186
200
runtime : false ,
@@ -194,7 +208,6 @@ export class NextFederationPlugin {
194
208
] . map ( ( plugin ) => plugin + '?runtimePlugin' ) ,
195
209
//@ts -ignore
196
210
exposes : {
197
- ...defaultExpose ,
198
211
...this . _options . exposes ,
199
212
...( this . _extraOptions . exposePages
200
213
? exposeNextjsPages ( compiler . options . context as string )
0 commit comments