Angular-auth-oidc-client: Reduce size of package

Created on 23 Jun 2017  路  9Comments  路  Source: damienbod/angular-auth-oidc-client

Package depends on jsrsasign which doesn't tree shake so good. See if it's possible to reduce the size of the auth.module

enhancement

Most helpful comment

Some example how it will be solved in this lib: https://github.com/manfredsteyer/angular-oauth2-oidc/pull/356

200kb are really huge, 13% of our bundle

All 9 comments

Hi,

other thing that don't tree shake very well is rxjs, if you load the bundled file:
import { Observable } from 'rxjs/Rx';

noticed in
https://github.com/damienbod/angular-auth-oidc-client/blob/40790b8909f5218536c6f4f92d7f8329ac5b225d/src/services/oidc.security.service.ts#L7

on other places, your doing the right thing:
https://github.com/damienbod/angular-auth-oidc-client/blob/40790b8909f5218536c6f4f92d7f8329ac5b225d/src/services/oidc.security.user-service.ts#L3

more info on why importing rxjs/RX is bad: https://christianliebel.com/2017/07/import-rxjs-correctly/

i could do a PR with this, no prob...glad to contribute

ps: i use https://www.npmjs.com/package/source-map-explorer to check what parts of libs was really bundled. Thats how i spot that i was loading the whole rxjs lib after i added your lib.

@ruimserrano thanks, nice fix

Hi,

the jsrsasign is adding about 200 kb to the final bundle (after minification and tree shaking). is there something to do about it please?

Some example how it will be solved in this lib: https://github.com/manfredsteyer/angular-oauth2-oidc/pull/356

200kb are really huge, 13% of our bundle

@damienbod any idea how do you want to tackle this. I would like to help here but I鈥檓 not sure if it will be accepted.

as far as I can tell, there are 2 possible approaches:

  1. create a custom build/package of jsrsasign.
  2. replace jsrsasign with another package.

Can we do a pro/con?

closing this, please open if you still have an issue

@damienbod was something done here? I can鈥檛 find any commit which solves the problem with jsrsasign . Any special reason to close it?

improved in version 10.0.8. Using a jsrsasign which is reduced in size now. 146kb instead of 254kb

Was this page helpful?
0 / 5 - 0 ratings