Heroku pipeline - staging env variable carried into production
You cannot rebuild the slug, the main point of pipelines is to move the same slug between apps.
What you need to do is to fetch API_URL
at runtime and not during build process. You can put all envs in one file, for example env.js
export const API_URL = process.env.API_URL;
export const OTHER_VAR = process.env.OTHER_VAR;
And then just import what you need in other files
import { API_URL, OTHER_VAR } from 'env.js';