)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

Importing Required Syncfusion Angular components to reduce bundle size

Platform: jQuery |
Control: General |
Published Date: July 20, 2017 |
Last Revised Date: May 8, 2019
Tags: angular, angular2

Importing Required Syncfusion Angular components to reduce bundle size

 

To use Syncfusion Angular Components, we need dependencies syncfusion-javaScript, jQuery and Jsrender.

The Syncfusion Angular components supports module loading. Since while importing EJAngular2Module from ej-angular2 package, it automatically loads its dependencies from npm:syncfusion-javascript package, this may cause bundle size bigger.

To reduce the bundle size import, required Angular components from ej-angular2 package, so that the bundle size will be reduced.

import { NgModule, enableProdMode, ErrorHandler } from '@angular/core';

. . . . .

 

import { EJ_BUTTON_COMPONENTS } from 'ej-angular2/src/ej/button.component';

 

import { AppComponent } from './app.component';

import { HomeComponent } from './home/home.component';

import { ButtonComponent } from './button/button.component';

 

import { rootRouterConfig } from './app.routes';

 

 

@NgModule({

  imports: [

    BrowserModule, FormsModule, HttpModule, RouterModule.forRoot(rootRouterConfig, { useHash: true })

  ],

  declarations: [

    AppComponent, HomeComponent, ButtonComponent,

    EJ_BUTTON_COMPONENTS

  ],

  bootstrap: [AppComponent]

})

export class AppModule { }

 

 

The table depicts calculated build bundle size for importing ej-angular2 module.

Scenario

Bundle size (in KB)

Before importing ej-angular2 package

86

 

Importing EJAngular2Module from ej-angular2 package. 

11672 

 

 

Importing required components.

 

For example, ejButton component from ej-angular2 package.

 

132

 

 

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon