Open claquesous opened 1 month ago
Based on the errors, it looks like the problem is in the eshaz/webworker library where Next.js is attempting to use the Node Web Worker polyfill.
The Web Worker code is used by the wasm-audio-decoders library for iOS compatibility, so if there is a problem there, iOS playback may not work as expected.
Could you try replacing your existing import IcecastMetadataPlayer from 'icecast-metadata-player'
with what @DCRepublic did here https://github.com/eshaz/icecast-metadata-js/issues/197#issuecomment-1974924934. This should force the import and everything downstream that it uses to be evaluated client side. If it works, I think the warning should also go away.
So I can report back that the fix basically has the same effect as the dynamic
option. Both allow me to do a production build, but neither are killing the stream of warnings. Unfortunately, this option is causing me TypeScript troubles, so I'll probably stick with the dynamic
option which also feels a little more readable.
On a side note, I don't understand why 'use client'
isn't the fix. It seems the most straightforward and even idiomatic for this scenario.
Apologies I didn't check closed issues for this. It's clearly happened a few times. I'd be happy to submit a PR to put a pointer in the README.
I'm getting constant warnings when using IcecastMetadataPlayer in a Next.js app.
I'm including it in a component called
player.tsx
this way:import IcecastMetadataPlayer from 'icecast-metadata-player'
When I tried a production build, I get this output during the build step which match the warnings when running in dev mode.
Originally, the
Generating static pages
step failed too, but I used this workaround to get the overall build to succeed: https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#with-no-ssrI don't really know much about Web Assembly, but I'm guessing the dynamic workaround could be because it just won't work server side. So be it. I'm wondering if the warning is legitimate though.
Thanks for your consideration.