Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(next-swc/relay): make pages directory optional (#43116)
Fixes: relayjs/relay-examples#241 (comment) **Context:** Current relay transformer requires `pages_dir` in its entry point: https://github.com/vercel/next.js/blob/ecfd2f4cd6a1c3f6bc3cd1cca6b62a3cb705a4e2/packages/next-swc/crates/core/src/relay.rs#L184 But consider the case that `pages_dir` is not provided because the page system is built entirely in the app directory introduced from Next.js 13. In this case, transformer causes unconditional panics even though there's nothing wrong with it. This PR removes panic in entry point and changes the type of `pages_dir` into `Option<T>` so that keeps [build stability for existing page system](https://github.com/vercel/next.js/blob/ecfd2f4cd6a1c3f6bc3cd1cca6b62a3cb705a4e2/packages/next-swc/crates/core/src/relay.rs#L157-L160) even if `pages_dir` is not provided.
- Loading branch information