next.js
55f24e0e - Turbopack: Skip ssr processing when next/dynamic ssr: false (#77636)

Commit
1 year ago
Turbopack: Skip ssr processing when next/dynamic ssr: false (#77636) ### What? Ensuring server-side processing for the loader function of `next/dynamic` with `ssr: false` is properly skipped in Turbopack. ### Why? Previously, client components imported through `next/dynamic` with `ssr: false` were not skipped, while they are skipped in webpack. This fix ensures consistent behavior between Webpack and Turbopack. This is a compilation performance win for applications that leverage this pattern heavily, as it can skip work it doesn't need to process. Was looking at fixing one of the failing tests in the list of remaining tests. Found it checked for this behavior and fixed it. ### How? - Added the same `should_skip_ssr_compile` logic to the Turbopack state that was already implemented for Webpack - When `ssr: false` is specified and we're in the server compiler we replace the dynamic import with an empty async function to avoid bundling the client component on the server
Author
Parents
Loading