Skip to content

❌ Can't use this package in Next.js: import.meta.url error during SSR #151

Description

@hemanthkt

When trying to use react-audio-voice-recorder in a Next.js project, I receive the following error:

Module not found: Can't resolve ''

It seems to be related to the use of:

new URL(o, import.meta.url).href
import.meta.url doesn't work properly in Next.js/webpack-based server-side environments, causing SSR builds to fail.

--

Possible Fix:

A fix might be to avoid using import.meta.url or provide a fallback that only runs on the client (i.e., inside useEffect or check typeof window !== 'undefined').

Let me know if you'd accept a PR for this — I'd be happy to help fix it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions