next
Version:
The React Framework
31 lines (30 loc) • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const NextInstrumentationClientLoader = async function() {
const { modules } = this.getOptions();
if (modules.length === 0) {
return `module.exports = require('private-next-instrumentation-client-user');\n`;
}
// Resolve each module specifier against the project root so the emitted
// `require()` calls don't get resolved relative to the stub's location
// inside `node_modules/next/`. Bare specifiers (npm package names) are
// resolved against the project's `node_modules`.
const resolve = this.getResolve();
const rootContext = this.rootContext;
const resolvedModules = await Promise.all(modules.map((spec)=>resolve(rootContext, spec)));
const allModules = [
...resolvedModules,
'private-next-instrumentation-client-user'
];
return `module.exports = [${allModules.map((spec)=>`require(${JSON.stringify(spec)})`).join(',')}];\n`;
};
const _default = NextInstrumentationClientLoader;
//# sourceMappingURL=next-instrumentation-client-loader.js.map