react-webpack-generators / generator-react-webpack

Yeoman generator for ReactJS and Webpack
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
MIT License
2.88k stars 355 forks source link

Including process.env values in src/config object #207

Closed sinisterra closed 8 years ago

sinisterra commented 8 years ago

Hi there,

Just wondering: is it possible to include process.env properties into the src/config object? If so, how can I do it? Thanks a lot!

Keep up the good work, this generator is amazing!

weblogixx commented 8 years ago

Hi @sinisterra,

indeed it seems to be possible. Just add your wanted variables via webpacks define plugin (you can see an example in cfg/dist.js for this). You are able to use set variables in the frontend via process.env.VARNAME.

Seems to work in frontend and dist versions.

Hope this helps.

weblogixx commented 8 years ago

Closing this as there was no feedback for 3 weeks. Please feel free to reopen this ticket if your problem still persists.