File tree Expand file tree Collapse file tree
module/public-path-global-runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ text
Original file line number Diff line number Diff line change 1+ it ( "should use/not use globalThis" , ( ) => {
2+ expect ( new URL ( "./file.text" , import . meta. url ) ) . toBeDefined ( ) ;
3+
4+ const stats = __STATS__ . children [ __STATS_I__ ] ;
5+
6+ expect ( stats . modules . length ) . toBe ( __STATS_I__ === 0 ? 6 : 5 ) ;
7+ } ) ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ const supportsGlobalThis = require ( "../../../helpers/supportsGlobalThis" ) ;
4+
5+ module . exports = ( ) => supportsGlobalThis ( ) ;
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+ output : {
8+ environment : { globalThis : false }
9+ } ,
10+ stats : {
11+ runtimeModules : true
12+ }
13+ } ,
14+ {
15+ target : "web" ,
16+ output : {
17+ environment : { globalThis : true }
18+ } ,
19+ stats : {
20+ runtimeModules : true
21+ }
22+ }
23+ ] ;
Original file line number Diff line number Diff line change 1+ it ( "should use/not use globalThis" , ( ) => {
2+ expect ( global ) . toBeDefined ( ) ;
3+
4+ const stats = __STATS__ . children [ __STATS_I__ ] ;
5+
6+ expect ( stats . modules . length ) . toBe ( __STATS_I__ === 0 ? 2 : 1 ) ;
7+ } ) ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ const supportsGlobalThis = require ( "../../../helpers/supportsGlobalThis" ) ;
4+
5+ module . exports = ( ) => supportsGlobalThis ( ) ;
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+ output : {
8+ environment : { globalThis : false }
9+ } ,
10+ stats : {
11+ runtimeModules : true
12+ }
13+ } ,
14+ {
15+ target : "web" ,
16+ output : {
17+ environment : { globalThis : true }
18+ } ,
19+ stats : {
20+ runtimeModules : true
21+ }
22+ }
23+ ] ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ module . exports = function supportsGlobalThis ( ) {
4+ try {
5+ eval ( "globalThis" ) ;
6+ return true ;
7+ } catch ( _err ) {
8+ // Ignore
9+ }
10+
11+ return false ;
12+ } ;
You can’t perform that action at this time.
0 commit comments