I am currently using Webpack with Angular and I would like to inject/use variables depending on weather it is development or production.
I have Webpack already setup for this to detect if prod or dev but I am having a problem sending variables to JavaScript / Angular.
I thought initially the solution was using DefinePlugin but this isn't available as a global variable in JavaScript / Angular.
new webpack.DefinePlugin({
API_URL: JSON.stringify('testing')
}),
Does anyone know a solution to this? I just really need to send in variables or files to angular depending weather its production or development. An example is the use of a API backend base url. It's different in development to production.
Commenting lines out seems such a bad idea if there is some way of supporting this in an automated way.
As I say, I already have a variable in Webpack to decided if its production or dev but just having an issue telling Angular / JavaScript. Any ideas?