next.js
1f3178e7 - fix(next-core): allow runtime segment option in pages/api (#58409)

Commit
2 years ago
fix(next-core): allow runtime segment option in pages/api (#58409) ### What This PR fixes turbopack to allow runtime segment option (https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes#segment-runtime-Option) in pages/api. Previously it only allows config object (https://nextjs.org/docs/app/building-your-application/routing/middleware#matcher), so the single runtime export like `export const runtime = 'edge'` didn't work. PR updates logic to parse config in the module to allow single segment export as well. It doesn't allow _both_, if config object is exported it'll short-curcuit to read values as config object should able to specify runtime without separate runtime segment. Closes PACK-1961
Author
Parents
Loading