File tree Expand file tree Collapse file tree 10 files changed +27
-29
lines changed Expand file tree Collapse file tree 10 files changed +27
-29
lines changed Original file line number Diff line number Diff line change @@ -1271,7 +1271,7 @@ impl CliFactory {
12711271 } else {
12721272 deno_resolver:: loader:: AllowJsonImports :: WithAttribute
12731273 } ,
1274- require_modules : options. require_modules ( ) . unwrap_or_default ( ) ,
1274+ require_modules : options. require_modules ( ) ? ,
12751275 } ,
12761276 ) ) )
12771277 } )
Original file line number Diff line number Diff line change @@ -883,6 +883,8 @@ impl LibMainWorker {
883883 self . worker . evaluate_module ( id) . await ?;
884884 self . worker . run_event_loop ( false ) . await ?;
885885 }
886+ // Even though we load as ESM here, these files will be forced to be loaded as CJS
887+ // because of checks in get_known_mode_with_is_script
886888 for require_module_url in self . require_modules . iter ( ) {
887889 let id = self . worker . preload_side_module ( require_module_url) . await ?;
888890 self . worker . evaluate_module ( id) . await ?;
Original file line number Diff line number Diff line change @@ -2,5 +2,9 @@ console.log("main_multiple.ts starts");
22
33console . log ( `First: ${ globalThis . __first__ } ` ) ;
44console . log ( `Second: ${ globalThis . __second__ } ` ) ;
5+ console . log ( `First filename: ${ globalThis . __first_filename__ } ` ) ;
6+ console . log ( `Second filename: ${ globalThis . __second_filename__ } ` ) ;
7+ console . log ( `First dirname: ${ globalThis . __first_dirname__ } ` ) ;
8+ console . log ( `Second dirname: ${ globalThis . __second_dirname__ } ` ) ;
59
610console . log ( "main_multiple.ts finished" ) ;
Original file line number Diff line number Diff line change 11require_first.js loading
2+ require_first.js platform: [WILDCARD]
23require_second.js loading
4+ require_second.js path separator: [WILDCARD]
35main_multiple.ts starts
46First: first
57Second: second
8+ First filename: [WILDCARD]require_first.js
9+ Second filename: [WILDCARD]require_second.js
10+ First dirname: [WILDCARD]require_modules_multiple
11+ Second dirname: [WILDCARD]require_modules_multiple
612main_multiple.ts finished
Original file line number Diff line number Diff line change 11console . log ( "require_first.js loading" ) ;
2+
3+ const os = require ( "node:os" ) ;
4+
5+ console . log ( `require_first.js platform: ${ os . platform ( ) } ` ) ;
6+
27globalThis . __first__ = "first" ;
8+ globalThis . __first_filename__ = __filename ;
9+ globalThis . __first_dirname__ = __dirname ;
Original file line number Diff line number Diff line change 11console . log ( "require_second.js loading" ) ;
2+
3+ const path = require ( "node:path" ) ;
4+
5+ console . log ( `require_second.js path separator: ${ path . sep } ` ) ;
6+
27globalThis . __second__ = "second" ;
8+ globalThis . __second_filename__ = __filename ;
9+ globalThis . __second_dirname__ = __dirname ;
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments