使用Webpack缩小Angular 2

时间:2018-02-14 14:54:41

标签: angular uglifyjs

在Angular 2应用上运行UglifyJs,收到错误消息

  

Can't bind to 'ngforOf' since it isn't a known property of 'a'

以下是一些来自配置的摘录:

module: {
    preLoaders: [{
        test: /\.ts$/,
        loader: 'tslint'
    }] ...

plugins: [
    new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
        mangle: {
            keep_fnames: true
        }
    })...

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

在模板套管中是正确的 - 它是ngFor,资本'F` - 显然UglifyJs正在降低它?

a(*ngFor='let language of languageList', (click)='selectLanguage(language)') {{language}}

0 个答案:

没有答案