File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
fixtures/module-federation-config Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const ModuleFederationPlugin = require ( 'webpack' ) . container
4
+ . ModuleFederationPlugin ;
5
+
6
+ module . exports = {
7
+ mode : 'development' ,
8
+ target : 'node' ,
9
+ context : __dirname ,
10
+ entry : [ './entry1.js' ] ,
11
+ plugins : [
12
+ new ModuleFederationPlugin ( {
13
+ name : 'app1' ,
14
+ library : { type : 'var' , name : 'app1' } ,
15
+ filename : 'remoteEntry.js' ,
16
+ exposes : {
17
+ './entry1' : './entry1' ,
18
+ } ,
19
+ } ) ,
20
+ ] ,
21
+ infrastructureLogging : {
22
+ level : 'warn' ,
23
+ } ,
24
+ } ;
Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ const simpleConfig = require('../fixtures/module-federation-config/webpack.confi
7
7
const objectEntryConfig = require ( '../fixtures/module-federation-config/webpack.object-entry.config' ) ;
8
8
const multiConfig = require ( '../fixtures/module-federation-config/webpack.multi.config' ) ;
9
9
const port = require ( '../ports-map' ) . ModuleFederation ;
10
+ const isWebpack5 = require ( '../helpers/isWebpack5' ) ;
11
+
12
+ let pluginConfig ;
13
+
14
+ if ( isWebpack5 ) {
15
+ pluginConfig = require ( '../fixtures/module-federation-config/webpack.plugin' ) ;
16
+ }
10
17
11
18
describe ( 'module federation' , ( ) => {
12
19
describe . each ( [
@@ -52,4 +59,25 @@ describe('module federation', () => {
52
59
} ) ;
53
60
}
54
61
} ) ;
62
+
63
+ ( isWebpack5 ? describe : describe . skip ) ( 'use plugin' , ( ) => {
64
+ let server ;
65
+ let req ;
66
+
67
+ beforeAll ( ( done ) => {
68
+ server = testServer . start ( pluginConfig , { port } , done ) ;
69
+ req = request ( server . app ) ;
70
+ } ) ;
71
+
72
+ afterAll ( testServer . close ) ;
73
+
74
+ it ( 'should contain hot script' , async ( ) => {
75
+ const { statusCode } = await req . get ( '/remoteEntry.js' ) ;
76
+ expect ( statusCode ) . toEqual ( 200 ) ;
77
+ await req . get ( '/main.js' ) . expect ( 200 , / w e b p a c k \/ h o t \/ d e v - s e r v e r \. j s / ) ;
78
+ await req
79
+ . get ( '/remoteEntry.js' )
80
+ . expect ( 200 , / w e b p a c k \/ h o t \/ d e v - s e r v e r \. j s / ) ;
81
+ } ) ;
82
+ } ) ;
55
83
} ) ;
You can’t perform that action at this time.
0 commit comments