0

i want to add custom environment variables when using react-boilerplate. In my DEV environment i will point the API to my localhost backend, but in PROD environment i will point it to the PROD backend. I have tried using dotenv-webpack and react-scripts but still won't work. for the dotenv-webpack i have add the plugins code below dllPlugin.

dllPlugin: {
...
},

plugins: [
new Dotenv({
  path: './.env', // Path to .env file (this is the default) 
  systemvars: true,
  safe: true // load .env.example (defaults to "false" which does not use dotenv-safe) 
})
]
...

anyone have succeed applying this feature ? please throw some enlightment..

semuzaboi
  • 4,972
  • 5
  • 20
  • 35
cumibulat
  • 434
  • 3
  • 6
  • 22

1 Answers1

-2

I have successfully implement the dotenv-webpack to the react-boilerplate. Before I misplaced the config at /config.js. Now i put in webpack/webpack.base.babel.js.

cumibulat
  • 434
  • 3
  • 6
  • 22