next-video
next-video copied to clipboard
turbopack support
By default, when using turbopack dev it throws an error
@apps/www:dev: [next] ⨯ ModuleBuildError: ./apps/@www/videos/payments.mp4
@apps/www:dev: [next] Unknown module type
@apps/www:dev: [next] This module doesn't have an associated type. Use a known file extension, or register a loader for it.
@apps/www:dev: [next]
@apps/www:dev: [next] Read more: https://nextjs.org/docs/app/api-reference/next-config-js/turbo#webpack-loaders
+1
Thanks for reporting!
yes, for now turbopack doesn't support inline webpack loaders which next-video uses for the video type.
we might need to export this as a separate package to make this to work. not sure if we'll get to this before Turbopack reaches parity.
I did some digging again and the blocker is Turbopack requires support for importing binaries (raw) files (mp4's). https://github.com/vercel/next.js/discussions/72147
Tried this today and managed to get a few steps in but it's still complaining about them when I view one of the pages
experimental: {
turbo: {
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json', '.mp4'],
rules: {
'./videos/*.mp4': {
loaders: ['next-video/webpack/video-raw-loader.js'],
as: '*.json',
},
'./videos/*.mp4.json': {
loaders: ['next-video/webpack/video-json-loader.js'],
as: '*.json',
},
},
},
},
Extension seems to be wrong:
Failed to compile
./videos/coblocks-ai.mp4.json.json
Code generation for chunk item errored
An error occurred while generating the chunk item [project]/videos/coblocks-ai.mp4.json.json (json)
Caused by:
- failed to convert rope into string
- invalid utf-8 sequence of 1 bytes from index 35
yes, thanks for digging in! Turbopack is trying to convert the imported file to a string I believe which is not we want. it should stay raw (binary)
As of between about a month ago and yesterday, Turbopack's latest version is causing issues with mux
TypeError: (0 , __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f40$mux$2f$mux$2d$node$2f$_shims$2f$registry$2e$mjs__$5b$app$2d$rsc$5d$__$28$ecmascript$29$__.getDefaultAgent) is not a function
at async AdminLessonHome (rsc://React/Server/C:%5CUsers%5Clazen%5CWebstormProjects%5Cclevoro-2%5C.next%5Cserver%5Cchunks%5Cssr%5C%5Broot%20of%20the%20server%5D__1d871d31._.js?0:94:26)
at resolveErrorDev (http://localhost:3000/_next/static/chunks/node_modules_next_dist_compiled_38d265cf._.js:3290:48)
at processFullStringRow (http://localhost:3000/_next/static/chunks/node_modules_next_dist_compiled_38d265cf._.js:3506:23)
at processFullBinaryRow (http://localhost:3000/_next/static/chunks/node_modules_next_dist_compiled_38d265cf._.js:3494:9)
at progress (http://localhost:3000/_next/static/chunks/node_modules_next_dist_compiled_38d265cf._.js:3640:102)
at InnerLayoutRouter (http://localhost:3000/_next/static/chunks/node_modules_next_dist_1a6ee436._.js:351:55)
at OuterLayoutRouter (http://localhost:3000/_next/static/chunks/node_modules_next_dist_1a6ee436._.js:498:73)
@luwes Could you please elaborate on this?
we might need to export this as a separate package to make this to work.
and maybe provide a simple example would be highly appreciated 🙏
@okerx my old comment is not correct. the fix in next-video will require this change in Next.js in Turbopack https://github.com/vercel/next.js/pull/75056
Working with turbopack is blocking us from integrating next-video with mux. Any workarounds? Without turbo pack our local development nearly crawls to a halt.
Working with turbopack is blocking us from integrating next-video with mux. Any workarounds? Without turbo pack our local development nearly crawls to a halt.
The issue here is that turbopack is unable to work with something within the core of mux. But I have removed turbopack from my build so that I can keep going. Sorry to not have more to give.
I removed next-video instead as turbo pack is not really optional for us
Turbopack has a fix for this staged: https://github.com/vercel/next.js/pull/75056#issuecomment-2808874442
I am facing the same issue. What's the solution for this ?
This blocked by the Next.js v15.4.0 release. When it's released we can fix this issue.
Next 15.4 is released. Eagerly waiting instructions on how to fix. Thanks.
any news on this fix? Thanks!
I'm willing to take this on. Please let me know if you have any guidance @luwes
Thanks for the interest y'all! I've put up a PR that half works. The issue now is that changes to the .json files are not detected and causing a reload by Turbopack. If you could help investigate that would be great!
This is a related issue https://github.com/vercel/next.js/issues/81926 but it says it's fixed? 🤷♂️
Thank you @luwes! As https://github.com/vercel/next.js/issues/81926 recommends, I'll try the latest canary. Too bad this might not hit till 15.4.7 :(
any updates here?