File tree Expand file tree Collapse file tree 4 files changed +11
-16
lines changed Expand file tree Collapse file tree 4 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { removeUnnecessarySharedKeys } from './remove-unnecessary-shared-keys';
22
33describe ( 'removeUnnecessarySharedKeys' , ( ) => {
44 beforeEach ( ( ) => {
5- jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
5+ jest . spyOn ( console , 'warn' ) . mockImplementation ( jest . fn ( ) ) ;
66 } ) ;
77
88 afterEach ( ( ) => {
Original file line number Diff line number Diff line change 66} from '@module-federation/enhanced' ;
77
88class InvertedContainerPlugin {
9- constructor ( ) { }
10-
119 public apply ( compiler : Compiler ) : void {
1210 compiler . hooks . thisCompilation . tap (
1311 'EmbeddedContainerPlugin' ,
Original file line number Diff line number Diff line change 11import { FederationRuntimePlugin } from '@module-federation/runtime/types' ;
2- import {
3- ModuleInfo ,
4- ConsumerModuleInfoWithPublicPath ,
5- } from '@module-federation/sdk' ;
62
73export default function ( ) : FederationRuntimePlugin {
84 return {
@@ -199,22 +195,23 @@ export default function (): FederationRuntimePlugin {
199195 return args ;
200196 }
201197
202- // re-assign publicPath based on remoteEntry location
203- if ( options . inBrowser ) {
204- remoteSnapshot . publicPath = remoteSnapshot . publicPath . substring (
198+ // re-assign publicPath based on remoteEntry location if in browser nextjs remote
199+ const { publicPath } = remoteSnapshot ;
200+ if ( options . inBrowser && publicPath . includes ( '/_next/' ) ) {
201+ remoteSnapshot . publicPath = publicPath . substring (
205202 0 ,
206- remoteSnapshot . publicPath . lastIndexOf ( '/_next/' ) + 7 ,
203+ publicPath . lastIndexOf ( '/_next/' ) + 7 ,
207204 ) ;
208205 } else {
209206 const serverPublicPath = manifestUrl . substring (
210207 0 ,
211208 manifestUrl . indexOf ( 'mf-manifest.json' ) ,
212209 ) ;
213-
214210 remoteSnapshot . publicPath = serverPublicPath ;
215- if ( 'publicPath' in manifestJson . metaData ) {
216- manifestJson . metaData . publicPath = serverPublicPath ;
217- }
211+ }
212+
213+ if ( 'publicPath' in manifestJson . metaData ) {
214+ manifestJson . metaData . publicPath = remoteSnapshot . publicPath ;
218215 }
219216
220217 return args ;
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export type { FlushedChunksProps } from './flushedChunks';
2222 */
2323export const revalidate = function (
2424 fetchModule : any = undefined ,
25- force : boolean = false ,
25+ force = false ,
2626) : Promise < boolean > {
2727 if ( typeof window !== 'undefined' ) {
2828 console . error ( 'revalidate should only be called server-side' ) ;
You can’t perform that action at this time.
0 commit comments