Hello everyone, I want to build next application based on environment variable. for example I want to run npm build but my API is going to be different than a production built so I want to change the API URL for client side in my development built. so basically I want to set API URL for client side using environment while building the app. can anyone guide me how I can achieve this or is this even possible or not.
#Development build based on env
5 messages · Page 1 of 1 (latest)
I am a bit confuse about env in production for client side. Let me share my correct flow, then please recommend a solution.
baseURL: apiUrl[process.env.NODE_ENV],
I am using this, but the links are const
const apiUrl = {
test: "http://localhost:8000",
development: "http://localhost:8000",
production: "https://api.example.com",
};