Optimize client-side @commercetools/sdk-auth
Description
A lot of useless code coming with this library:
- Buffer polyfill
- Lodash (defaultsDeep)
Expected Behavior
It works without these libraries or load them only on demand.
Current Behavior
It works with these libraries and is impossible even to replace them if you use just simple import SdkAuth, { TokenProvider } from '@commercetools/sdk-auth'; because it uses the UMD version.
Possible Solution
https://github.com/commercetools/nodejs/pull/1649 https://github.com/commercetools/nodejs/pull/1650 https://github.com/commercetools/nodejs/pull/1651
+1 This prevents this library from being used with build tools such as Vite - which inherently don't support node polyfills in the browser - which subseqeuntly spits out ReferenceError: Buffer is not defined for any node related modules