Next.js

Next.js: Turbopack Gets Smart, HMR Gets Stable

Today brings 20 merged PRs and 25 commits focused heavily on Turbopack improvements and developer experience. Major highlights include inline loader configuration via import attributes, comprehensive HMR fixes for module factories, and better debugging with React owner stacks in prerender errors.

Duration: PT4M4S

https://podlog.io/listen/next-js-36fde2ae/episode/next-js-turbopack-gets-smart-hmr-gets-stable-498cc3c9

Transcript

Hey there, amazing developers! Welcome back to another episode of the Next.js podcast. I'm here with your daily dose of what's happening in the framework we all love, and honestly, today feels like one of those days where everything just clicks into place. We've got 20 merged pull requests and 25 additional commits, and there's a clear theme running through everything - making Turbopack smarter and your development experience smoother.

Let me start with the headline feature that's got me genuinely excited. Tobias just landed support for inline loader configuration via import attributes in Turbopack. This is huge! You know how you've always had to configure webpack loaders globally in your next config? Well, now you can apply them right at the import level using the with clause. Picture this - you can do `import rawText from '../data.txt' with { turbopackLoader: 'raw-loader' }` or even pass options like `import value from '../data.js' with { turbopackLoader: 'string-replace-loader', turbopackLoaderOptions: '{"search":"PLACEHOLDER","replace":"replaced value"}' }`. It's webpack-compatible but with that per-import granularity that just makes sense.

Speaking of Turbopack improvements, JJ tackled a really tricky HMR issue that's been causing those mysterious "module factory is not available" errors. The fix involved preserving group factory consistency for compressed modules - basically making sure that when Turbopack is juggling multiple module versions during hot reloading, it doesn't lose track of which factory belongs where. It's one of those behind-the-scenes fixes that you'll never notice when it works, but you'd definitely notice when it doesn't.

The debugging story got a major upgrade too. There's now support for React owner stacks in prerender errors when you use the `--debug-prerender` flag. Hendrik put together this really thoughtful solution that captures exactly which component triggered uncached I/O or accessed request data without Suspense. No more hunting through cryptic stack traces - you'll know exactly where the problem is.

Luke fixed something that might seem small but is actually pretty important for modern web development. You know how you might want to have both `icon.png` and `icon.svg` in your app for browser fallback support? That was causing Turbopack to crash and webpack to behave weirdly. Now both formats work perfectly, giving you proper progressive enhancement for icons.

The team also graduated the `turbopackIgnoreIssue` config from experimental to stable. It's now `turbopack.ignoreIssue` in your next config, which is a nice signal that the API is solid and ready for production use.

I want to highlight some of the internal improvements too, because they matter for long-term stability. Benjamin updated how Turbopack handles global naming for turbo-task items using Rust's type system more effectively. Luke optimized trait registration to use type IDs instead of global names, saving memory and processing time. These might sound technical, but they're the kind of foundational work that makes everything else faster and more reliable.

The documentation got some love too, with a comprehensive new activity boundary guide that'll help you understand caching behavior better. And yes, even a simple blockquote formatting fix made it in - because good documentation matters at every level.

Today's focus is really about two things. First, if you're using Turbopack, definitely explore those new inline loader capabilities. They open up some really elegant patterns for handling special imports without polluting your global config. Second, if you've been hitting HMR issues with module factories, today's fixes should resolve a lot of that instability.

The momentum on Turbopack continues to be incredible. We're seeing it mature from an experimental bundler into something that's genuinely improving the developer experience in measurable ways. The fact that we can now have webpack-compatible loaders with better ergonomics than webpack itself is pretty remarkable.

That's a wrap on today's updates! Keep building amazing things, and I'll catch you tomorrow with whatever exciting changes the team ships next. Until then, happy coding!