I'm wondering how I can set the default runtime for my project.
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
Hi, Next.js developers! Is there a way to set the default runtime for the whole project without adding
export const runtime = 'edge' to each file? Thanks!11 Replies
European sprat
what happens if you set it in the root layout?
looks like that works even for route handlers
@European sprat looks like that works even for route handlers
Masai LionOP
Did you test it? This can be a solution. Thank you for helping me!
I was searching for next.config on the website's documentation but I didn't find this specific config on the current version in the official docs.
I found this code but it was on another website, so I was wondering if is it an outdated approach or not:
Thanks again!
I was searching for next.config on the website's documentation but I didn't find this specific config on the current version in the official docs.
I found this code but it was on another website, so I was wondering if is it an outdated approach or not:
experimental: {
runtime: 'experimental-edge',
},Thanks again!
@Masai Lion Did you test it? This can be a solution. Thank you for helping me!
I was searching for next.config on the website's documentation but I didn't find this specific config on the current version in the official docs.
I found this code but it was on another website, so I was wondering if is it an outdated approach or not:
experimental: {
runtime: 'experimental-edge',
},
Thanks again!
European sprat
I thought there was something in next config too but couldn't find it
I just tested in dev exporting runtime in root layout then tested some pages and route handlers
Masai LionOP
I am experiencing some difficulties while starting a project at this moment and I plan to test it when the issues get resolved. thanks
@European sprat I thought there was something in next config too but couldn't find it
it used to be there, but has been removed
@Masai Lion Did you test it? This can be a solution. Thank you for helping me!
I was searching for next.config on the website's documentation but I didn't find this specific config on the current version in the official docs.
I found this code but it was on another website, so I was wondering if is it an outdated approach or not:
experimental: {
runtime: 'experimental-edge',
},
Thanks again!
yes it was outdated and deprecated; no longer available since i think v13
Masai LionOP
I have pasted the code in the root layout @European sprat mentioned earlier but It does not work for me. the page is 404 when I am pasting this code. so maybe you @joulev know how to set config for all routes to be 'edge' without specifying in each file? thanks
@Masai Lion I have pasted the code in the root layout <@135324139648057344> mentioned earlier but It does not work for me. the page is 404 when I am pasting this code. so maybe you <@484037068239142956> know how to set config for all routes to be 'edge' without specifying in each file? thanks
No, it is impossible, you must specify it in each file
Masai LionOP
Thanks!