analytics/services/collector/scripts/register-loader.mjs

13 lines
398 B
JavaScript

/**
* Register the ESM loader using the modern API
*/
import { register } from 'node:module';
import { pathToFileURL } from 'node:url';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const loaderPath = join(__dirname, 'esm-loader.mjs');
register(pathToFileURL(loaderPath).href, import.meta.url);