Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. declare const production: any;
  2. export default production;
  3.  
  4. config.plugins.push(
  5. new DefinePlugin({
  6. 'production': env.prod === 'true'
  7. }),
  8. ...
  9. )
  10.  
  11. import isProduction from '../../environment/isProduction';
  12.  
  13. // Main Http module looks like
  14. @NgModule({
  15. imports: [HttpCustomModule],
  16. providers: [
  17. {
  18. provide: CustomersService,
  19. useFactory: (httpClient: HttpClient) => {
  20. return isProduction
  21. ? new CustomersHttpService(httpClient)
  22. : new CustomersService(httpClient);
  23. },
  24. deps: [HttpClient]
  25. },
  26. {
  27. provide: ProfilesService,
  28. useClass: isProduction ? ProfilesHttpService : ProfilesService,
  29. deps: [HttpClient]
  30. },
  31. ...
  32.  
  33. })
  34. export class HttpBackendModule { }
  35.  
  36. import { NgModule, isDevMode } from '@angular/core';
  37.  
  38. "scripts": {
  39. "build-app:dev": "webpack --mode development --config webpack.config.app.babel.js --env.prod=true --watch",
  40. "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