How can I target the edge runtime?
Unanswered
Chien Français Blanc et Noir posted this in #help-forum
Chien Français Blanc et NoirOP
I am getting an error when building my application with a home-made package and I would like to export a copy of the package's code that is compatible with the
Does anyone know?
edge-runtime due to the error list bellw? I tried to check the page mentioned in the error but I can't find any information which value I should use for the exports-block in package.json. Does anyone know?
ui:build: ../../packages/logging/dist/ConsoleStructuredLogger.js
ui:build: A Node.js API is used (process.pid at line: 69) which is not supported in the Edge Runtime.
ui:build: Learn more: https://nextjs.org/docs/api-reference/edge-runtime
ui:build:
ui:build: Import trace for requested module:
ui:build: ../../packages/logging/dist/ConsoleStructuredLogger.js
ui:build: ../../packages/logging/dist/structuredLogger.js
5 Replies
export const runtime = "nodejs" or "edge"
Note: Middleware is always on edge so you can't do nodejs only stuff on it
@Arinji export const runtime = "nodejs" or "edge"
Page and layouts only
Chien Français Blanc et NoirOP
I want to make a build of my package that doesn't access
process.pid targeting edge-runtime. If I understand you correctly it would: { "exports": { ".": { "edge": "./edge/index.js" etc }?sorry i not really sure abt this