i could maybe initialize the logger with an export let
i could maybe initialize the logger with an export let

⨯ Error: Cannot find module 'node:async_hooks'
node: from the import as i reuse the code for a page and a worker, and worker only works when the node: is specified lol ⨯ Error: Cannot find module 'node:async_hooks'page:build: ▲ Failed to compile.
page:build: ▲ node:async_hooks
page:build: ▲ Module build failed: UnhandledSchemeError: Reading from "node:async_hooks" is not handled by plugins (Unhandled scheme).
page:build: ▲ Webpack supports "data:" and "file:" URIs by default.
page:build: ▲ You may need an additional plugin to handle "node:" URIs.node:node:export function middleware(request: NextRequest) {
const rayId =
request.headers.get("CF-Ray") ??
Math.floor(Math.random() * 10000).toString();
return als.run(rayId, () => NextResponse.next());
}config.plugins.push(
new webpack.IgnorePlugin({
resourceRegExp: /^node:async_hooks$/,
}),
);config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/^node:.*$/, (resource) => {
resource.request = resource.request.replace("node:", "");
}),
);
config.resolve.fallback = {
...config.resolve.fallback,
async_hooks: false,
};