awslabs / aws-jwt-verify

JS library for verifying JWTs signed by Amazon Cognito, and any OIDC-compatible IDP that signs JWTs with RS256, RS384, and RS512
Apache License 2.0
598 stars 43 forks source link

[vite]: Rollup failed to resolve import "#node-web-compat" #107

Closed jrowen closed 1 year ago

jrowen commented 1 year ago

I'm trying to include this library in a Vue 3 project using vite build but seeing the following error.

[vite]: Rollup failed to resolve import "#node-web-compat" from "node_modules/aws-jwt-verify/dist/esm/jwt-rsa.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

Is this expected, and if so, is there a recommended workaround to allow vite to accept this package?

ottokruse commented 1 year ago

Last I checked, Rollup needs a bit of extra config to make sense of the subpath import. See here: https://github.com/awslabs/aws-jwt-verify/blob/main/tests/vite-app/vite.config.ts

jrowen commented 1 year ago

That's what I needed, thanks.