Skip to content

Commit

Permalink
feat: add enableProdMode() in RenderNgAppService when NODE_ENV !== 'd…
Browse files Browse the repository at this point in the history
…evelopment'
  • Loading branch information
ThibaudAV committed Nov 23, 2020
1 parent 2539265 commit bcc6277
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/angular/src/client/preview/angular/RenderNgAppService.ts
@@ -1,5 +1,5 @@
/* eslint-disable no-undef */
import { NgModule, NO_ERRORS_SCHEMA, Type } from '@angular/core';
import { enableProdMode, NgModule, NO_ERRORS_SCHEMA, Type } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

Expand Down Expand Up @@ -66,6 +66,15 @@ export class RenderNgAppService {
}
this.storyProps$ = new BehaviorSubject<ICollection>(storyObj.props);

if (typeof NODE_ENV === 'string' && NODE_ENV !== 'development') {
try {
enableProdMode();
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
}

await this.platform.bootstrapModule(
createModuleFromMetadata(getNgModuleMetadata(storyObj, this.storyProps$))
);
Expand Down

0 comments on commit bcc6277

Please sign in to comment.