Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare const production: any;
- export default production;
- config.plugins.push(
- new DefinePlugin({
- 'production': env.prod === 'true'
- }),
- ...
- )
- import isProduction from '../../environment/isProduction';
- // Main Http module looks like
- @NgModule({
- imports: [HttpCustomModule],
- providers: [
- {
- provide: CustomersService,
- useFactory: (httpClient: HttpClient) => {
- return isProduction
- ? new CustomersHttpService(httpClient)
- : new CustomersService(httpClient);
- },
- deps: [HttpClient]
- },
- {
- provide: ProfilesService,
- useClass: isProduction ? ProfilesHttpService : ProfilesService,
- deps: [HttpClient]
- },
- ...
- })
- export class HttpBackendModule { }
- import { NgModule, isDevMode } from '@angular/core';
- "scripts": {
- "build-app:dev": "webpack --mode development --config webpack.config.app.babel.js --env.prod=true --watch",
- "build-app:prod": "webpack --mode production --config webpack.config.app.babel.js --env.prod=true",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement