2016-08-21 236 views
0

我曾经在我的控制台执行以下命令:如何发布角2应用与角2 CLI +的WebPack

ng build --prod 

和我的DIST文件夹已与以下文件生成:

enter image description here

我他们上传到我的虚拟主机,并得到了以下错误:

polyfills.c27b87b….bundle.js:1 Unhandled Promise rejection: Template parse errors: 
Can't bind to 'item' since it isn't a known property of 'simple-notification'. 
1. If 'simple-notification' is an Angular component and it has 'item' input, then verify that it is part of this module. 
2. If 'simple-notification' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. 
("<simple-notification 
       *ngFor="let a of notifications; let i = index" 
       [ERROR ->][item]="a" 
       [timeOut]="timeOut" 
       [clickToClose]="clickToClose" 

与我在我的应用程序中使用的简单通知包的许多不同错误。

除了生成的dist文件夹以外,还需要上传哪些内容才能发布我的应用程序?

+0

看起来像一个与您SimpleNotification做一个运行时错误 零件。你有一个@Input称为项目? https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#parent-to-child – itamar

+0

命令ng serve --prod是否有效? –

+0

@itamar嗯..我不 – TheUnreal

回答

0

模板解析存在已知问题。您可以避免缩小Html。

模板解析是不是因为它应该和角度团队提供了一个解决办法对他们的文档的权利,但现在完全希望它应该尽快修复webpack.config文件中添加此

htmlLoader: { 
    minimize: false // workaround for ng2 
    }, 

或者正常工作

{ 
    test: /\.html$/, 
    loader: `html?-minimize` 
} 

workaround from angular.io Also see this answer

+0

在我的'node_modules \ angular-cli \ addon \ ng2 \ models'中找到了'webpack.config.ts'文件,你的意思是那个文件或者是否有其他文件需要更新? – TheUnreal

+0

尝试使用该文件,它应该工作。 –