Fix: Build error causes infinite loop on new dev overlay in Turbopack (#75984)
### What? When you enable both Turbopack, and the new dev overlay, you will see that the dev overlay is frozen and the network tab shows that it is fetching the stack frames API indefinitely. ### Why? During our migration to the new development overlay, we implemented a refactor to ensure that logic for handling runtime errors is executed consistently, even in the case of build-time errors. This change involves invoking the getErrorByType function for build errors. However, this function attempts to retrieve stack frames for the build-time error, inadvertently triggering Turbopack to initiate a rebuild. Once Turbopack completes the rebuild process, it dispatches a Hot Module Replacement (HMR) event to indicate the presence of a new error. This event prompts getErrorByType to attempt fetching the stack frames again, which in turn causes Turbopack to rebuild once more. This creates an endless loop of rebuilding and error signaling. You can repro it by running ``` __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY='true' TURBOPACK=1 pnpm testonly-dev test/development/acceptance-app/editor-links.test.ts ``` with the test file change in this PR. (Important to add that. Otherwise the test would still complete successfully) ### How? Do not run the runtime error logic for build errors. Closes NDX-816
Showing
Please
register
or
sign in
to comment