File tree Expand file tree Collapse file tree 4 files changed +75
-0
lines changed
test/configCases/dynamic-import/self-import Expand file tree Collapse file tree 4 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ it ( "should allow to import itself" , async ( ) => {
2+ // Dynamic import with self-import (e.g., import(import.meta.url)) does not create duplicate ChunkGroups
3+ // because the module is already in parent chunks, so it enters the skip logic at buildChunkGraph.js:734-738
4+ // (isOrdinalSetInMask check returns true).
5+ const module = await import ( import . meta. url ) ;
6+ expect ( module ) . toBeDefined ( ) ;
7+ } ) ;
8+
9+ it ( "should allow to import itself with new URL" , async ( done ) => {
10+ import ( new URL ( import . meta. url ) ) . catch ( e => {
11+ // import with new URL will create a ContextModule with critical flag
12+ // ContextModule will throw MODULE_NOT_FOUND
13+ expect ( e . code ) . toBe ( "MODULE_NOT_FOUND" ) ;
14+ done ( ) ;
15+ } ) ;
16+ } ) ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ module . exports = {
4+ findBundle ( i ) {
5+ switch ( i ) {
6+ case 0 :
7+ return [ `bundle${ i } .js` ] ;
8+ case 1 :
9+ return [ `runtime.bundle${ i } .js` , `main.bundle${ i } .js` ] ;
10+ case 2 :
11+ return [ `bundle${ i } .mjs` ] ;
12+ case 3 :
13+ return [ `runtime.bundle${ i } .mjs` , `main.bundle${ i } .mjs` ] ;
14+ }
15+ }
16+ } ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ module . exports = [
4+ / C r i t i c a l d e p e n d e n c y : t h e r e q u e s t o f a d e p e n d e n c y i s a n e x p r e s s i o n / ,
5+ / C r i t i c a l d e p e n d e n c y : t h e r e q u e s t o f a d e p e n d e n c y i s a n e x p r e s s i o n / ,
6+ / C r i t i c a l d e p e n d e n c y : t h e r e q u e s t o f a d e p e n d e n c y i s a n e x p r e s s i o n / ,
7+ / C r i t i c a l d e p e n d e n c y : t h e r e q u e s t o f a d e p e n d e n c y i s a n e x p r e s s i o n /
8+ ] ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ /** @type {import("../../../../").Configuration[] } */
4+ module . exports = [
5+ {
6+ target : "web"
7+ } ,
8+ {
9+ output : {
10+ filename : "[name].bundle1.js"
11+ } ,
12+ target : "web" ,
13+ optimization : {
14+ runtimeChunk : "single"
15+ }
16+ } ,
17+ {
18+ target : "web" ,
19+ experiments : {
20+ outputModule : true
21+ }
22+ } ,
23+ {
24+ target : "web" ,
25+ output : {
26+ filename : "[name].bundle3.mjs"
27+ } ,
28+ optimization : {
29+ runtimeChunk : "single"
30+ } ,
31+ experiments : {
32+ outputModule : true
33+ }
34+ }
35+ ] ;
You can’t perform that action at this time.
0 commit comments