Skip to content

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

@hemanthkt

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.

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