fix(next-swc/relay): make pages directory optional (#43116)
Fixes: https://github.com/relayjs/relay-examples/pull/241#issuecomment-1318756698 **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.
Showing
Please
register
or
sign in
to comment