I\'ve created company internal library using angualr2-library yeoman generator.
Some of the angular services are using environment variables in our current applicati
If You are still looking for the answer. In the current version i.e. Angular > 6, you don't have to do anything.
The angular-cli commands "ng build --prod (for Production)& ng build (for Development)" will take care of it for you.
Example: If you are running the project in development environment, all the variables are captured from src/environments/environment.ts. In your component library project just import "import { environment } from 'environments/environment';" (please make sure about the path) will takecare of the environment depending upon the angular-cli build command.