We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Angular Build Optimizer Apparently Not Working with EJ2

Hello,

Regarding: Angular 6.1, Angular CLI 6.0, Syncfusion Libraries as follows (from package.json), Google Chrome, Apple Safari:

...
"@syncfusion/ej2-angular-base": "^17.1.49",
"@syncfusion/ej2-angular-buttons": "^17.1.47",
"@syncfusion/ej2-angular-calendars": "^17.1.49",
"@syncfusion/ej2-angular-dropdowns": "^17.1.49",
"@syncfusion/ej2-angular-grids": "^17.1.48",
"@syncfusion/ej2-angular-inputs": "^17.1.49",
"@syncfusion/ej2-base": "^17.1.49",
"@syncfusion/ej2-data": "^17.1.47",
"@syncfusion/ej2-navigations": "^17.1.49",
...

I am trying to create a production build from a solution that includes various Syncfusion libraries such as EJ2 GridEJ2 Date Picker, and others as listed above, using the command ng build --prod. If the build-optimiser option is disabled (as set in the angular.json file or using the relevant CLI flag) the resultant production build works with no major issues. However, including build-optimizer results in a production build that crashes with various errors similar to the following as reproduced from  the web browser console:

ERROR ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor
    at new Jt (ej2-grids.es2015.js.pre-build-optimizer.js:10671)
    at new mi (ej2-angular-grids.js.pre-build-optimizer.js:295)
    at Oo (core.js.pre-build-optimizer.js:11738)
    at So (core.js.pre-build-optimizer.js:11559)
    at sa (core.js.pre-build-optimizer.js:13100)
    at Object.Xo [as createEmbeddedView] (core.js.pre-build-optimizer.js:12959)
    at no.createEmbeddedView (core.js.pre-build-optimizer.js:11064)
    at Yi.createEmbeddedView (core.js.pre-build-optimizer.js:10845)
    at Be._updateView (common.js.pre-build-optimizer.js:3878)
    at Be.set ngIf [as ngIf] (common.js.pre-build-optimizer.js:3846)

The element, in this case the EJ2 grid, does not render and the web app stalls. Similar errors encountered elsewhere in the web app have the same ReferenceError and the stack trace always includes reference to an EJ2 library.

This issue is not reproducible in development builds.

It is believed that the Angular Build Optimizer does not seem to play well with the EJ2 libraries and I know from exploring the Syncfusion forum and looking elsewhere at other community resources that this is a problem with certain libraries.

  • Is there any workaround? I am not too keen on disabling Build Optimizer support as the resulting production build chunks are too large without its optimisations.
  • Is there any potential fix in the pipeline. I had tried to use an updated version of the Angular Build Optimizer, i.e. version 0.13.9, but this did not help.

1 Reply

JA Jesus Arockia Sankaran S Syncfusion Team June 3, 2019 05:48 PM UTC

Hi Eric Lew, 

Sorry for the inconvenience.  

We checked the reported problem by creating an Angular sample with the mentioned configuration, but we cannot reproduce the reported problem. You can get the sample from the link below.  


Reference Image

 

If you need further help on this, please get back to us. 
 
Regards, 
Jesus Arockia Sankaran S 


Loader.
Live Chat Icon For mobile
Up arrow icon