turbo
e6633a59 - Update ContextCondition::InPath to match exact path (#5938)

Commit
2 years ago
Update ContextCondition::InPath to match exact path (#5938) ### Description Updates the `ContextCondition::InPath` matching code to also accept the exact path as "in". | InPath | `InPath("/foo/bar")` | `InPath("/foo/bar/baz.js`") | |---------------------|----------------------|-----------------------------| | `"/foo/bar"` | `false` -> `true` | `false` | | `"/foo/bar.js"` | `false` | `false` | | `"/foo/bar/baz.js"` | `true` | `false` -> `true` | This change is necessary to fix our `ResolveOptions` when the Next.js entrypoint templates import the special `@vercel/turbopack/pages/_app` module, which is import mapped to the user's `/pages/_app` file. If the user is using `.ts` (or similar `.tsx`, etc) extensions, we need to ensure that the default `ResolveOptions` allows this import to find the file. But without this change, we won't be able to prevent the [foreign_code_context_condition](https://github.com/vercel/next.js/blob/85d30b62db4606bf56a6a9533494c9e14d55e1cc/packages/next-swc/crates/next-core/src/util.rs#L83-L101) rule from altering our `ResolveOptions` to only import `.js`/`.json`/`.node` files. ### Testing Instructions Closes WEB-1544
Author
Parents
Loading