Change hard coded url constants for different environments via webpack
You can store your API_URL in webpack config: // this config can be in webpack.config.js or other file with constants var API_URL = { production: JSON.stringify(‘prod-url’), development: JSON.stringify(‘dev-url’) } // check environment mode var environment = process.env.NODE_ENV === ‘production’ ? ‘production’ : ‘development’; // webpack config module.exports = { // … plugins: [ new webpack.DefinePlugin({ … Read more