MasterKale / SimpleWebAuthn

WebAuthn, Simplified. A collection of TypeScript-first libraries for simpler WebAuthn integration. Supports modern browsers, Node, Deno, and more.
https://simplewebauthn.dev
MIT License
1.63k stars 138 forks source link

Unexpected token 'export' #133

Closed timstrasser closed 3 years ago

timstrasser commented 3 years ago

I just updated the '@simplewebauthn/browser' dependency in my NUXT project (from ^3.0.0 to ^3.1.0) and now the pages that require startAttestation from the @simplewebauthn/browser package no longer render.

I get the following error: webpack:/external "@simplewebauthn/browser" Missing stack framesJS Object.@simplewebauthn/browser@1:

(https://prnt.sc/17aah2p)

I don't know how to further debug this error. Let me know if I can provide more information on this error.

akanass commented 3 years ago

@timstrasser Did you check the README because in the latest version, main version is in ES2018 and you have to transpile it by yourself with your bundle system if you want a lower browser support or in commonjs

export is from ESM code and you are not running ESM version if you have this error, so you have to transpile it to CJS with your bundler.

timstrasser commented 3 years ago

No, indeed I did not check the README. Thanks! Now it's working again!

akanass commented 3 years ago

@timstrasser as it's explained in the official documentation you can extend webpack config to transpile ESM to CJS by adding some plugin.

timstrasser commented 3 years ago

Yes, I found it fox NUXT here (https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-build#transpile). :)

Thanks for the quick response!