나는 프로덕션을 위해 내 코드를 축소하려고 노력하고 있습니다 (개발 모드에서 웹팩을 실행하면 모든 것이 잘 작동합니다). 주요 차이점은 UglifyJsPlugin
플러그인입니다. 해당 플러그인으로 프로젝트를 제공하면 JS 콘솔에서 다음을 얻습니다.
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 () 또는 inputs 구성 요소 속성의 확인에 대해 말하는 곳을 찾을 수 있습니다. 이것이 도움이된다면 rc5를 사용하고 있습니다.
고마워, 존
템플릿 구문 분석이 제대로 작동하지 않으며 Angular 팀은 현재 문서에 대한 해결 방법을 제공했지만 webpack.config 파일에서 곧 수정되기를 바랍니다.
htmlLoader: {
minimize: false // workaround for ng2
},
또는
{
test: /\.html$/,
loader: `html?-minimize`
}
이것도 시도
mangle : false를 사용하여 명시 적으로 맹 글링을 비활성화합니다.
new webpack.optimize.UglifyJsPlugin({
// Mangling specific options
mangle: false
})
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다