react-mic icon indicating copy to clipboard operation
react-mic copied to clipboard

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

Open hemanthkt opened this issue 7 months ago • 0 comments

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.

hemanthkt avatar May 25 '25 08:05 hemanthkt