Skip to content

Throw useful error if atob / btoa are not defined #30

@gr2m

Description

@gr2m

universal-github-app-jwt is a universal library with different code for Node/Browser. It has a "browser" key to override the entry point for browser builds:

"browser": {
"./pkg/dist-src/get-token.js": "./pkg/dist-src/get-token-browser.js"
},

Unfortunately build tools such as WebPack end up using this entry point, too, even when building for Node targets. See for example: octokit/auth-app.js#59. There has been a lot of discussion around this topic, but no conclusion on how to resolve it.

But the least we could do is to check if atob exists in src/utils.ts. If it doesn't, then throw a helpful error which could include a link to the README file where we could add some information about this challenge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions