PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

Fix to avoid angular compiler.es5.js getting bundled in AOT enabled webpack builds #119

Closed shripalsoni04 closed 7 years ago

shripalsoni04 commented 7 years ago

Currently when we use this plugin and if we prepare AOT build using nativescript-dev-webpack plugin, I found that @angular/compiler/@angular/compiler.es5.js (size: ~966KB) is also getting bundled in bundle.js. Ideally this file should not get bundled in AOT builds.

I tried to find the root cause using webpack analyze tool and found that it is getting included because of below line:

nativescript-drop-down/angular/index.ts

import { BaseValueAccessor, registerElement } from "nativescript-angular";

This nativescript-angular modules is requiring nativescript-angular/platform and that is importing @angular/compiler.

When I changed the above import line to as shown below, the final build did not included the compiler.es5.js, resulting in smaller and faster build compared to before.

import { registerElement } from "nativescript-angular/element-registry";
import { BaseValueAccessor } from "nativescript-angular/value-accessors/base-value-accessor";

If you find this proper, then please apply this change. Let me know in case of any issues/concerns.

Thanks.

shripalsoni04 commented 7 years ago

Hi @PeterStaev , Thanks for merging this PR. I think it is not yet published to NPM. It will be great if you can publish it to NPM. Thanks.

PeterStaev commented 7 years ago

Hey @shripalsoni04 , sorry the version is now published.

shripalsoni04 commented 7 years ago

No problem @PeterStaev . Thanks for publishing it. It is working as expected now 👍