How to make Angular mock service tree-shakeable
问题 Context In an Angular 9 project, I am working with two environments: production & mock . In the Core Module, I check for mock environment. If build is made with mock configuration I inject mocked services that return mocked data, so no external http requests are made. If build is made with prod configuration, real services are injected. I do it like this: core.module.ts @NgModule({ declarations: [], providers: [], imports: [BrowserModule, HttpClientModule], exports: [], }) export class