next.js
6dbba05e - Fix default regex for `require.context` in Turbopack analyzer (#94162)

Commit
23 hours ago
Fix default regex for `require.context` in Turbopack analyzer (#94162) Here is the original bug found by Claude: ``` static DEFAULT_REGEX: LazyLock<EsRegex> = LazyLock::new(|| EsRegex::new(r"^\\./.*$", "").unwrap()); The raw string is the literal ^\\./.*$. Regex parses \\ as a single backslash, so this matches paths starting with \<any>/…. The comment correctly cites webpack's default /^\.\/.*$/ ("any file"); the Rust raw string should be r"^\./.*$" (single backslash). Today, every default require.context filter rejects valid relative paths. ``` This PR makes the suggested change + adds a unit test that was previously failing but now succeeds.
Author
Parents
Loading