interop-alliance / oidc-web

OIDC (OpenID Connect) authentication client for web browsers (Relying Party wrapper)
MIT License
1 stars 3 forks source link

Add a Webpack/exclude section in the README #1

Open dmitrizagidulin opened 6 years ago

dmitrizagidulin commented 6 years ago

Since many devs are likely to use this with something like Webpack, add a section mentioning the required exclude/externals section. For example, for webpack, the config must include:

  externals: {
    'node-fetch': 'fetch',
    'text-encoding': 'TextEncoder',
    'whatwg-url': 'window',
    '@trust/webcrypto': 'crypto'
}
dmitrizagidulin commented 6 years ago

Just for reference / future searchability, not including that externals section results in errors like:

algorithms_sync:2 Uncaught (in promise) Error: Cannot find module '../dictionaries/RsaHashedKeyAlgorithm'
    at webpackEmptyContext (algorithms_sync:2)
    at SupportedAlgorithms.normalize (SupportedAlgorithms.js:84)
    at SubtleCrypto.importKey (SubtleCrypto.js:239)
    at RSASSA_PKCS1_v1_5.importKey (RSASSA-PKCS1-v1_5.js:124)
    at Function.importKey (JWA.js:113)
    at Function.importKey (JWK.js:46)
    at Function.issueFor (PoPToken.js:57)
    at Session.bearerTokenFor (Session.js:61)
    at Session.fetchWithCredentials (Session.js:104)
    at eval (Session.js:133)