Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import with top level await stucks dev server with --turbo #65278

Open
pawelblaszczyk5 opened this issue May 2, 2024 · 1 comment
Open

Import with top level await stucks dev server with --turbo #65278

pawelblaszczyk5 opened this issue May 2, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.

Comments

@pawelblaszczyk5
Copy link

pawelblaszczyk5 commented May 2, 2024

Link to the code that reproduces this issue

https://github.com/pawelblaszczyk5/async-module-turbo-repro

To Reproduce

  1. Start the development server
  2. Try to open localhost:3000 in the browser
  3. Observe it never actually loading (if it loads, try to remove the import with top level await from page.tsx and add it back after sucessful compilation)

Video with reproduction:

https://www.youtube.com/watch?v=PJ9jI-0uDmg

As you can see it sometimes work after restarting the dev server or removing and adding back the import. In console I'm not getting GET / 200 in xxms sometimes and my browser is stuck loading, top bar spinning.

Current vs. Expected behavior

It should work fine, the same way as it does without --turbo.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.19
  pnpm: 8.15.7
Relevant Packages:
  next: 14.3.0-canary.36 // Latest available version is detected (14.3.0-canary.36).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

PACK-3039

@pawelblaszczyk5 pawelblaszczyk5 added the bug Issue was opened via the bug report template. label May 2, 2024
@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label May 2, 2024
@timneutkens
Copy link
Member

timneutkens commented May 4, 2024

Seems the minimal reproduction is this:

// app/page.tsx
import { x } from "./test";

/** Add your relevant code here for the issue to reproduce */
export default function Home() {
  return <h1>Hello world abc {x}</h1>;
}
// app/test.ts
export const x = 5;

const a = 10;
if (a !== 10) {
  await new Promise((resolve) => setTimeout(resolve, 100));
}

Anytime the condition is false it will get stuck, if the condition is true is does not get stuck. I.e. if (a === 10) { does not get stuck.

Sandbox: https://codesandbox.io/p/github/pawelblaszczyk5/async-module-turbo-repro/csb-28s59w/draft/clever-christian?file=%2Fapp%2Ftest.ts%3A1%2C1-7%2C1

@timneutkens timneutkens added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants