Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: should this library footprint adds 327 Kb to vendor chunk in angular cli build? #185

Closed
daBishMan opened this issue Dec 30, 2017 · 3 comments

Comments

@daBishMan
Copy link

Description of the Issue and Steps to Reproduce:
I think the footprint for this library is too large, is there a way to reduce it?

Did you search for duplicate issue? [Yes / No] Yes

Please describe the issue and steps to reproduce, preferably with a code sample / plunker:
I have an enterprise application and when I import the MomentModule to app.module imports the vendor bundle size is increased by ~300kb, the build command I used is

ng build --prod --aot --build-optimizer -vc true -cc true -ec false -scd --named-chunks

this is can be replicated using the CLI and new project using the following:

Angular CLI: 1.6.3
Node: 8.9.3
OS: win32 x64
Angular: 5.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.3
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.5.3
webpack: 3.10.0

results of the build with MomentModule imported:

Time: 52064ms
chunk {advanced-search.module} advanced-search.module.d60beec7722da129c586.chunk.js () 1.87 kB  [rendered]
chunk {auth.module} auth.module.67add23d3ed68ef686af.chunk.js () 12.1 kB  [rendered]
chunk {common} common.382dca4d9da70a5daaa3.chunk.js (common) 113 bytes  [rendered]
chunk {feature.module} feature.module.8482ed5235a98d276a0d.chunk.js () 6.45 kB  [rendered]
chunk {history.module} history.module.db345e57bfb0cf422ceb.chunk.js () 1.74 kB  [rendered]
chunk {inline} inline.bff18dfc6f4c8611bfd7.bundle.js (inline) 1.79 kB [entry] [rendered]
chunk {intelli-search.module} intelli-search.module.5455c43a3f4fbb0953fb.chunk.js () 1.77 kB  [rendered]
chunk {main} main.411800e5cafe5e5bcefd.bundle.js (main) 73.9 kB [initial] [rendered]
chunk {polyfills} polyfills.1986cf3b9e29e22436be.bundle.js (polyfills) 149 kB [initial] [rendered]
chunk {profile.module} profile.module.901f126106574d62c980.chunk.js () 1.73 kB  [rendered]
chunk {search.module} search.module.ea052aeaaa805ebf3ff8.chunk.js () 26.3 kB  [rendered]
chunk {styles} styles.f4792a97868f609f3fe4.bundle.js (styles) 149 kB [initial] [rendered]
chunk {vendor} vendor.2936f4ced451d8dbedd9.bundle.js (vendor) 823 kB [initial] [rendered]

results of the build without Moment Module imported:

Time: 46202ms
chunk {advanced-search.module} advanced-search.module.d60beec7722da129c586.chunk.js () 1.87 kB  [rendered]
chunk {auth.module} auth.module.67add23d3ed68ef686af.chunk.js () 12.1 kB  [rendered]
chunk {common} common.382dca4d9da70a5daaa3.chunk.js (common) 113 bytes  [rendered]
chunk {feature.module} feature.module.8482ed5235a98d276a0d.chunk.js () 6.45 kB  [rendered]
chunk {history.module} history.module.db345e57bfb0cf422ceb.chunk.js () 1.74 kB  [rendered]
chunk {inline} inline.8d8768ca6f208b110a0a.bundle.js (inline) 1.79 kB [entry] [rendered]
chunk {intelli-search.module} intelli-search.module.5455c43a3f4fbb0953fb.chunk.js () 1.77 kB  [rendered]
chunk {main} main.4358e05694a3d71b1ee8.bundle.js (main) 69.7 kB [initial] [rendered]
chunk {polyfills} polyfills.1986cf3b9e29e22436be.bundle.js (polyfills) 149 kB [initial] [rendered]
chunk {profile.module} profile.module.901f126106574d62c980.chunk.js () 1.73 kB  [rendered]
chunk {search.module} search.module.ea052aeaaa805ebf3ff8.chunk.js () 26.3 kB  [rendered]
chunk {styles} styles.f4792a97868f609f3fe4.bundle.js (styles) 149 kB [initial] [rendered]
chunk {vendor} vendor.b0269225422e427dd6c6.bundle.js (vendor) 496 kB [initial] [rendered]

You can see the decrease in vendor chunk.

Ensure your issue is isolated to angular2-moment. Issues involving third party tools will be closed unless submitted by the tool's author/maintainer.

Environment:
Windows 10 x64
Please answer the following questions:

  • Angular version? 5.1.2
  • TypeScript version? 2.5.3
  • moment version? 1.7.1
  • Are you using moment-timezone? no
  • Are you using the angular-cli? yes
  • Using Rollup/Webpack/System.js/Ionic/similar? no
@urish
Copy link
Owner

urish commented Dec 30, 2017

This probably have to do with moment locales being bundled in - see #127 / #168 for a workaround, also see angular/angular-cli#6137 for discussion

@liluxdev
Copy link

how to select language for displaying time ago strings at runtime?

@urish urish closed this as completed Apr 17, 2018
@urish
Copy link
Owner

urish commented Jun 30, 2018

See #197 for a workaround that doesn't require ejecting or moving files around after every package update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants