const API = process.env.api;
module.exports = {
...,
plugins: [
...,
new webpack.DefinePlugin({
API_URL: JSON.stringify(API)
})
]
}
{
"scripts": {
"build": "webpack --env.api=https://api.url/v1"
}
}
npm run build -- --env.api=https://api.url/v2