您好我在angular2种子项目中集成vaadin元素时遇到了一个问题。
我遇到了第一个错误:
Error: Error: XHR error (404 Not Found) loading http://localhost:5555/node_modules/@vaadin/package.json(…)
我通过在project.config.ts文件中添加代码解决了这个问题:
this.SYSTEM_CONFIG_DEV.paths['@vaadin/angular2-polymer'] =
`${this.APP_BASE}node_modules/@vaadin/angular2-polymer`;
this.SYSTEM_CONFIG_DEV.packageConfigPaths =
this.SYSTEM_CONFIG_DEV.packageConfigPaths.concat([
`${this.APP_BASE}node_modules/@vaadin/*/package.json`
]);
this.SYSTEM_BUILDER_CONFIG.packages['@vaadin/angular2-polymer'] = {
main: 'index.js',
defaultExtension: 'js'
}
但是现在我的控制台出现了这个错误:
Error: TypeError: Cannot read property 'prototype' of undefined
at __extends (http://localhost:5555/node_modules/@vaadin/angular2-polymer/src/polymer-element.js:5:68)
at eval (http://localhost:5555/node_modules/@vaadin/angular2-polymer/src/polymer-element.js:12:5)
at Object.eval (http://localhost:5555/node_modules/@vaadin/angular2-polymer/src/polymer-element.js:23:2)
at eval (http://localhost:5555/node_modules/@vaadin/angular2-polymer/src/polymer-element.js:280:4)
at eval (http://localhost:5555/node_modules/@vaadin/angular2-polymer/src/polymer-element.js:281:3)
at eval (<anonymous>)
Evaluating http://localhost:5555/node_modules/@vaadin/angular2-polymer/src/polymer-element.js
Evaluating http://localhost:5555/node_modules/@vaadin/angular2-polymer/index.js
Evaluating http://localhost:5555/app/app.component.js
Evaluating http://localhost:5555/app/main.js
Error loading http://localhost:5555/app/main.js "Report this error at https://github.com/mgechev/angular2-seed/issues"
当我删除app.component.ts的代码行import { PolymerElement } from '@vaadin/angular2-polymer';
时,Angular2会成功启动。
有没有人有想法帮助我。
答案 0 :(得分:0)
您能否确保您的Angular 2版本与angular2-polymer库兼容。如果是,请按照Vaadin的文档https://vaadin.com/docs/-/part/elements/angular2-polymer/overview.html
中的指南进行操作