Skip to content

Commit a7faa3e

Browse files
committed
No need to detect ESM support
1 parent 6cb0944 commit a7faa3e

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

lib/worker/subprocess.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ require('./ensure-forked'); // eslint-disable-line import/no-unassigned-import
66

77
const ipc = require('./ipc');
88

9-
const supportsESM = async () => {
10-
try {
11-
await import('data:text/javascript,'); // eslint-disable-line node/no-unsupported-features/es-syntax
12-
return true;
13-
} catch {}
14-
15-
return false;
16-
};
17-
189
ipc.send({type: 'ready-for-options'});
1910
ipc.options.then(async options => {
2011
require('./options').set(options);
@@ -184,23 +175,10 @@ ipc.options.then(async options => {
184175
}).filter(provider => provider !== null);
185176

186177
let requireFn = require;
187-
let isESMSupported;
188178
const load = async ref => {
189179
for (const extension of extensionsToLoadAsModules) {
190180
if (ref.endsWith(`.${extension}`)) {
191-
if (typeof isESMSupported !== 'boolean') {
192-
// Lazily determine support since this prints an experimental warning.
193-
// eslint-disable-next-line no-await-in-loop
194-
isESMSupported = await supportsESM();
195-
}
196-
197-
if (isESMSupported) {
198-
return import(pathToFileURL(ref)); // eslint-disable-line node/no-unsupported-features/es-syntax
199-
}
200-
201-
ipc.send({type: 'internal-error', err: serializeError('Internal runner error', false, new Error('ECMAScript Modules are not supported in this Node.js version.'))});
202-
exit(1);
203-
return;
181+
return import(pathToFileURL(ref)); // eslint-disable-line node/no-unsupported-features/es-syntax
204182
}
205183
}
206184

0 commit comments

Comments
 (0)