-
Notifications
You must be signed in to change notification settings - Fork 694
Consider ES2015 modules and using individual JS files from jsrsasign #196
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
Comments
Thanks for this info. Lets consider this for a future release. Ofc, the bug with the main flag needs to be solved soon. But I have a quick solution for you:
If you go this way I would be happy about a contribution, e. g. a pull request. What do you think? |
Sure I will give it a try |
Did you find out sth? |
Just ran into this myself. Latest Rollup (0.56.3) does not tree shake jsrsasign away. (or it at least leaves the |
Thanks for this feedback. I will make this one priority for version 4.1. |
I've made this here: #356 |
If you are building with webpack and know that you do not use the functionality that is provided by jsrsasign, you can get rid of the dependency with the help of webpack (in my case webpack 4) We created a mock for the two modules used from jsrsasign jsrsasign.js module.exports.KEYUTIL = {
getKey: b => null,
};
module.exports.KJUR = {
jws: {
JWS: {
verifyJWT: (...a) => null,
},
},
}; Now all you have to do is add the following to your webpack config {
resolve: {
alias: {
jsrsasign$: 'path/to/your/jsrsasign.js',
}
}
} This will replace the dependency with your own file, reducing the bundle size drastically. |
any news for this issue ? Indeed it really heavy in my webpack analyze... |
https://bundlephobia.com/[email protected]
|
we are using the |
The maintainer chose a different route to fix this in Version 9.x, which does require switching to Code+PKCE flow (the new recommendation for SPA's). I will close this issue because I think the most honest current way of things is that for Implicit Flow with JWKS, or for versions <9.x, this will not be resolved. To summarize, your optins for getting rid of
|
Hi,
First of all thanks for a great library. I have trying to learn the concepts of OAuth and OIDC and this library comes very handy.
Currently, I tried using this in Angular-CLI project and checked that the application needs entire JS files from angular-oauth2-oidc (32kb) as well as jsrsasign (85kb). That's fairly big chunk to bring the first page as this library would be needed for authentication..
I see that we use quite minimal parts from JSRSAsign lib.
I checked if jsrsasign is ES2015 friendly.. but it appears that there are no immediate plans to move to ES2015 modules. But as the comments notes.. there are smaller bundles available for consumption.
I think using some libs from here should be sufficient for our usage.
Mostly.. we need below packages only.. (or may be even less)
Crypto
JWS
KeyUtil
Hope that can bring down needs of package size for jsrsasign library..
Similarly, I think right now library publishing has some issues leading to usage of entire library (umd.js). package.json specified module field as
"module": "angular-oauth2-oidc.js",
but this js file is not present in package that was downloaded (v3.1.4) May be that's why entire library must get included currently. Fixing this should bring down size for angular-oauth2-oidc library in overall bundle.Let me know if you need more information..
The text was updated successfully, but these errors were encountered: