Closed l1b3r closed 3 years ago
If you just need to check if a timestamp is past now, isn't using openid-client an overkill?
Anyway, treeshaking is a matter of tooling, if the exports could be done differently i'm happy to do it unless it's breaking, but i will not be spending time figuring out the how.
Hi, First off, thank you for such an amazing package!
I'm building a server-side solution with
openid-client
(with TypeScript), which is split into separate applications/bundles independent from each other "build-wise", so in the end I have multiple separatemain.js
files with whatever 3rd-party modules each particular app requires.One of the apps only needs a very little part of
openid-client
: just to check whether theTokenSet
is.expired
:This app doesn't do anything else auth-wise, so
TokenSet
is the only real class that is required. Yet, when I bundle the app using Webpack I notice thatopenid-client
is included in the bundle entirely along with all of its own deps. Everything works fine, but my production environment has strict bundle size constrictions, so I'm trying to shrink the bundles as much as possible.The question is: is it possible to somehow tree-shake
openid-client
with webpack so that is only includes only what I actually import from the package? For the case above that would presumably beopenid-client/lib/token_set.js
along with whatever that modulerequire
s.Alternatively I could just copy the logic of
.expired()
into my own function and ditchopenid-client
for that app completely, but this seems like an anti-pattern to me.Thanks