Next JS Runtime Variables
Unanswered
Romanian Mioritic Shepherd Dog posted this in #help-forum
Romanian Mioritic Shepherd DogOP
Hi,
How can I pass a runtime variable to my next js application so that it can override things even after building?
I am using Next JS 14 with app routing.
I tried using publicRuntimeConfig in next.config.js file but it worked only in server components
publicRuntimeConfig: {
NEXT_PUBLIC_TEST_URL: process.env.TEST_API_BASE_URL,
},
How can I pass a runtime variable to my next js application so that it can override things even after building?
I am using Next JS 14 with app routing.
I tried using publicRuntimeConfig in next.config.js file but it worked only in server components
publicRuntimeConfig: {
NEXT_PUBLIC_TEST_URL: process.env.TEST_API_BASE_URL,
},