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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Importing Required Syncfusion Angular components to reduce bundle size

Platform: JavaScript |
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.

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