更新npm开始后的角度cli给出错误 [英] Angular cli after update npm start give error

查看:107
本文介绍了更新npm开始后的角度cli给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用angular cli创建应用程序,并使用后端代理处理后端,并使用polymer(vaadin)正常工作,直到我更新到angular cli 1.0.0-beta.22并给出错误

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);

我该如何纠正??

推荐答案

这是由Angular CLI最新更新引起的.在最新更新中,webpack在main.ts顶层搜索boostrap Module.在main-polymer.ts中,main.tsaddEventListener包裹,因此webpack找不到引导程序模块,这就是它报告错误的原因.

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.

进一步参考 github.com/angular/angular-cli/issues/2887

这篇关于更新npm开始后的角度cli给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆