forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Turbopack] fix require.resolve self hanging (vercel#69793)
### What? evaluation require.resolve tries to resolve and process a module during module analytics. Since analytics is part of processing a module this can create a call cycle when `require.resolve("./self")` is used. This happens in some npm packages and caused Turbopack to hange. This PR fixes that problem by only resolving the module and not processing it when using `require.resolve`. In addition to that it adds a panic when a call cycle occurs. The next time we mess it up and create a call cycle this will crash Turbopack instead of hanging, which makes it much easier to find the problem. fixes PACK-3227
- Loading branch information
Showing
6 changed files
with
156 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...k/crates/turbopack-tests/tests/execution/turbopack/resolving/require-resolve/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"treeShakingMode": "reexports-only" | ||
} |