atinux / nuxt-auth-utils

Add Authentication to Nuxt applications with secured & sealed cookies sessions.
MIT License
980 stars 92 forks source link

App breaks without optional peer dependency @simplewebauthn/browser installed #262

Closed MasterCarl closed 3 weeks ago

MasterCarl commented 3 weeks ago

After upgrading from 0.4.4 to 0.5.0, I'm getting runtime errors such as

webauthn.js?v=1346bd92:2 Uncaught (in promise) SyntaxError: The requested module '/_nuxt/@id/__vite-optional-peer-dep:@simplewebauthn/browser:nuxt-auth-utils' does not provide an export named 'browserSupportsWebAuthn' (at webauthn.js?v=1346bd92:2:3)

The error originates from

import {browserSupportsWebAuthn, browserSupportsWebAuthnAutofill, platformAuthenticatorIsAvailable, startAuthentication, startRegistration} from "/_nuxt/@id/__vite-optional-peer-dep:@simplewebauthn/browser:nuxt-auth-utils";

Installing @simplewebauthn/browser fixes this issue, but that should be optional since I'm using

export default defineNuxtConfig({
auth: {
    webAuthn: false,
  }
})
atinux commented 3 weeks ago

Happy to take a look at it @Gerbuuun ?