Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
Angular2 - Webpack - Minification => UglifyJsPlugin
posted

Hi,

Whenever I enable minification by using the UglifyJsPlugin for webpack, I get following error.

"Template parse errors: Can't bind to 'dataSource' since it isn't a known property of 'ig-grid'. 1. If 'ig-grid' is an Angular component and it has 'dataSource' input, then verify that it is part of this module. 2. If 'ig-grid' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. (" <div> <ig-grid widgetId="grid1" [ERROR ->][dataSource]="mydata"></ig-grid> </div>' "): t@2:26 'ig-grid' is not a known element: 1. If 'ig-grid' is an Angular component, then verify that it is part of this module. 2. If 'ig-grid' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. (" <div> [ERROR ->]<ig-grid widgetId="grid1" [dataSource]="mydata"></ig-grid> </div>' "): t@2:0"

If I don't use the UglifyJsPlugin, everything works fine.

I've attached a sample app to demonstrate this behaviour.

I started from https://github.com/angularclass/angular2-webpack-starter.git, integrated 'igniteui-angular2' and enabled the UglifyJsPlugin in de webpack dev config.

Steps to reproduce:

1. npm install

2. npm start

Please advise on how to solve this.

Thanks!

angular2-webpack-starter.zip
  • 3995
    Verified Answer
    Offline posted

    Hello,

    This sounds like a third party issue. And I found more info on it here.

    So include keep_fnames to the mangle of the Uglify:

            mangle: {
              screw_ie8: true,
              keep_fnames: true
            },

    Also make sure you have declared you data initially:

    public mydata: any = [];


    angular2-webpack-starter_modified.zip