We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e1e66c commit 6b9daf0Copy full SHA for 6b9daf0
esm.mjs
@@ -1,13 +1,18 @@
1
import { fileURLToPath } from 'url';
2
import { createRequire } from 'module';
3
+import { versionGteLt } from './dist/util.js';
4
const require = createRequire(fileURLToPath(import.meta.url));
5
6
/** @type {import('./dist/esm')} */
7
const esm = require('./dist/esm');
8
export const { resolve, load, getFormat, transformSource } = esm.registerAndCreateEsmHooks();
9
10
// Affordance for node 20, where load() happens in an isolated thread
11
+const offThreadLoader = versionGteLt(process.versions.node, '20.0.0');
12
export const globalPreload = () => {
13
+ if (!offThreadLoader) {
14
+ return '';
15
+ }
16
const self = fileURLToPath(import.meta.url);
17
return `
18
const { createRequire } = getBuiltin('module');
0 commit comments