[X] I verified that the issue exists in Next.js canary release
Provide environment information
npx next info
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
Binaries:
Node: 16.13.1
npm: 8.1.2
Yarn: 1.22.17
pnpm: 6.30.0
Relevant packages:
next: 12.1.1-canary.17
react: 17.0.2
react-dom: 17.0.2
What browser are you using? (if relevant)
Microsoft Edge 99.0.1150.46 (Official build) (x86_64)
How are you deploying your application? (if relevant)
next dev
Describe the Bug
When Top Level Await is enabled in next.config.js, and some page uses Top Level Await, React Fast Refresh stops working and full refresh is always performed.
In real world scenarios, a page file may import some other module that uses Top Level Await. The result is same.
Verify canary release
Provide environment information
npx next info
What browser are you using? (if relevant)
Microsoft Edge 99.0.1150.46 (Official build) (x86_64)
How are you deploying your application? (if relevant)
next dev
Describe the Bug
When Top Level Await is enabled in
next.config.js
, and some page uses Top Level Await, React Fast Refresh stops working and full refresh is always performed.In real world scenarios, a page file may import some other module that uses Top Level Await. The result is same.
Expected Behavior
React Fast Refresh continues to work.
To Reproduce
https://github.com/yume-chan/next-repro-35537
npm i
npm run dev
Home
component inpages/index.js
, verify Fast Refresh works because input box retains its valuenpm run dev
, uncommentconfig.experiments.topLevelAwait = true;
innext.config.js
andawait Promise.resolve();
inpages/index.js