File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,6 +6,15 @@ require('./ensure-forked'); // eslint-disable-line import/no-unassigned-import
66
77const ipc = require ( './ipc' ) ;
88
9+ const supportsESM = async ( ) => {
10+ try {
11+ await import ( 'data:text/javascript,' ) ;
12+ return true ;
13+ } catch { }
14+
15+ return false ;
16+ } ;
17+
918ipc . send ( { type : 'ready-for-options' } ) ;
1019ipc . options . then ( async options => {
1120 require ( './options' ) . set ( options ) ;
@@ -134,23 +143,18 @@ ipc.options.then(async options => {
134143 return null ;
135144 } ) . filter ( provider => provider !== null ) ;
136145
137- // Lazily determine support since this prints an experimental warning.
138- let supportsESM = async ( ) => {
139- try {
140- await import ( '../esm-probe.mjs' ) ;
141- supportsESM = async ( ) => true ;
142- } catch {
143- supportsESM = async ( ) => false ;
144- }
145-
146- return supportsESM ( ) ;
147- } ;
148-
149146 let requireFn = require ;
147+ let isESMSupported ;
150148 const load = async ref => {
151149 for ( const extension of extensionsToLoadAsModules ) {
152150 if ( ref . endsWith ( `.${ extension } ` ) ) {
153- if ( await supportsESM ( ) ) { // eslint-disable-line no-await-in-loop
151+ if ( typeof isESMSupported !== 'boolean' ) {
152+ // Lazily determine support since this prints an experimental warning.
153+ // eslint-disable-next-line no-await-in-loop
154+ isESMSupported = await supportsESM ( ) ;
155+ }
156+
157+ if ( isESMSupported ) {
154158 return import ( pathToFileURL ( ref ) ) ;
155159 }
156160
You can’t perform that action at this time.
0 commit comments