Skip to content

turbopack-240525.2

@timneutkens timneutkens tagged this 25 May 17:57
### Description

In Next.js with webpack we have a feature to inline `typeof window` in
server/client environments. That allows e.g.

```
"use client"
if(typeof window === 'undefined') {
  import('server-only-package')
}
```

Today with Turbopack above code causes `server-only-package` to still be
loaded in the browser compilation. Which causes issues like
https://github.com/vercel/next.js/issues/66058 where the `if`/`else`
condition is used to use different modules for server and client.

This change is required to pass the test in
https://github.com/vercel/next.js/issues/66058

Pushing up the Next.js changes in that PR.

<!--
  ✍️ Write a short summary of your work.
  If necessary, include relevant screenshots.
-->

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->

---------

Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
Assets 2
Loading