2016-08-18 5 views
0

私は制作のために自分のコードを小型化しようとしています(開発モードでwebpackを実行するとすべてうまく動作します)。主な違いはUglifyJsPluginプラグインです。私はそのプラグインで私のプロジェクトに奉仕するとき、私はJSコンソールでこれを取得:@InputデコレータとUglifyJsPluginのベリファイ

polyfills.b0a99d4.bundle.js:5 Unhandled Promise rejection: Template parse errors: 
Can't bind to 'articles' since it isn't a known property of 'feed-grid'. 
1. If 'feed-grid' is an Angular component and it has 'articles' input, then verify that it is part of this module. 
2. If 'feed-grid' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. 

しかし、私は(それがこのプラグインなしで動作し、特に以来)私は正しく私の入力を宣言しています信じています。

import { Component, Input } from '@angular/core'; 
import { ArticleModel } from '../../models/article.model'; 

@Component({ 
    selector: 'feed-grid', 
    styleUrls: ['./feed-grid.scss'], 
    template: require('./feed-grid.html') 
}) 

export class FeedGrid { 
    @Input() articles: ArticleModel[] = []; 

    constructor() {} 
} 

私はこのUglifyプラグインで何か不足していて、それに入力を宣言していますか? @Input()の検証や入力コンポーネントの属性については、どこでも見つけることができます。これが役に立ったらrc5を使っています。それが必要と角度のチームは今のために自分のドキュメントに周りの仕事を提供するが、それは、これを追加し、すぐに修正しwebpack.configファイルにする必要があり、完全に期待しているように

おかげで、 ジョン

答えて

1

テンプレートの解析は正常に動作していません

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

それとも

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

もこれを試してみてください

mangle:falseを使用して、明示的にマングリングを無効にします。

new webpack.optimize.UglifyJsPlugin({  
      // Mangling specific options 
      mangle: false 
     }) 

Source

workaround from angular.io

+0

私は、HTMLLoaderを使用しますが、UglifyJSいませんでした。プラグイン設定https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin –

+0

にお返事に追加してください(mangle:falseを設定してください)。 –

関連する問題