These are chat archives for AngularClass/angular2-webpack-starter

3rd
Feb 2017
Pawel Kondraciuk
@pawelkondraciuk
Feb 03 2017 11:54
Hello! Is it possible to use env variables in index.html? I am trying to include google api script but it requires API KEY (different each environment)
Juan Aguilar
@botika
Feb 03 2017 12:54
Yes, with html-plugin. Only put your env variables in a global variable with process.env in metadata object and pass this . Like this https://github.com/AngularClass/angular2-webpack-starter/blob/master/config/webpack.common.js#L277
@pawelkondraciuk and this https://nodejs.org/api/process.html#process_process_env for pass your environment variables to node
Pawel Kondraciuk
@pawelkondraciuk
Feb 03 2017 13:00
@botika i've tried adding key into metadata (different across environments) but it only uses keys from webpack.common.ts