Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Example request: Angular CLI project #17

Closed
cmddavid opened this issue Apr 20, 2017 · 2 comments
Closed

Example request: Angular CLI project #17

cmddavid opened this issue Apr 20, 2017 · 2 comments

Comments

@cmddavid
Copy link

Im trying to use this in a Angular 4 CLI project, everything works fine on serve and build, only when a build is made for production im getting "Error: ", without any additional information. I'm pretty sure im doing something wrong with the platformBrowser part which breaks the AOT compilation.

I tried swapping platformBrowserDynamic for platformBrowser, but this gives new problems, so this is what i have now:

import './polyfills.ts';

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
import { AppModule } from './app/app.module';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule);

Any pointers?

@lacolaco
Copy link
Owner

I tried to do that and got a solution. COMPILER_PROVIDERS is required to bootstrap app w/ ng-dynamic.

But I got a problem, I cannot build w/ --prod flag. In building for production, some processes breaks my app code. I guess it's refactoring phase process that removes decorators in compiled code.

import { enableProdMode } from '@angular/core';
import { COMPILER_PROVIDERS } from '@angular/compiler';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic([...COMPILER_PROVIDERS]).bootstrapModule(AppModule);

@cmddavid
Copy link
Author

No longer relevant, outdated issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants