Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular cli after update npm start give error

I create application using angular cli and use backend proxy to handle backend and using polymer(vaadin) it work correctly until I update to angular cli 1.0.0-beta.22 it give Error

Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.

proxy.conf.json

{
  "/api": {
    "target": "http://127.0.0.1:3000",
    "secure": false
  }
}

main-polymer.ts

document.addEventListener('WebComponentsReady', () => {
  require('./main.ts');
});

main.ts

import './polyfills.ts';

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

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

// platformBrowserDynamic().bootstrapModule(AppModule);
platformBrowserDynamic().bootstrapModule(AppModule);

how can I correct this?.

like image 966
Rumes Shyaman Avatar asked Dec 06 '16 10:12

Rumes Shyaman


1 Answers

This is caused by Angular CLI latest update. In the latest update, webpack searches for boostrap Module in main.ts top level. In main-polymer.ts, main.ts is wrapped by addEventListener so webpack can't find the bootstrap module that's why it reports an error.

Further reference github.com/angular/angular-cli/issues/2887

like image 141
sanjeewa gunarathna Avatar answered Sep 24 '22 07:09

sanjeewa gunarathna