Inject environment config to angular app at runtime using webpack?

We follow CI/CD approach. So same build is required for QA and production. Thus enable to use angular environment files(fileReplacements) for configuration variables as build are different.

I choose to inject config via express in index.html via handlebars rendering in angular build(/dist) folder.

But when using ng serve command how can we inject config to html file via Webpack dev server?

I can use ng build --watch cmd. But setting up via webpack will be better for debugging.