Repository URL to install this package:
|
Version:
0.9.1 ▾
|
@supertenant/collector
/
esm-loader.mjs
|
|---|
// (c) Copyright 2023 Supertenant Ltd. - all rights reserved.
// See LICENSE file in project root for license terms.
/**
* We currently only instrument CJS modules. As soon as we want
* to instrument ES modules (such as `got` v12), the requireHook will
* no longer work. Therefor we would need to wrap the target ES module
* with our instrumentations using the resolve & load hook.
*
* Usage:
* node --experimental-loader=@supertenant/collector/esm-loader.mjs server.js
*
* NOTE: When using ESM the customer can only configure the collector with
* ENV variables.
*/
// eslint-disable-next-line import/extensions
import init from './src/index.js';
init();
/*
export async function resolve(specifier, context, nextResolve) {
return nextResolve(specifier, context, nextResolve);
}
export async function load(url, context, nextLoad) {
return nextLoad(url, context, nextLoad);
}
*/