From de9b047ac2f6220007d204303aa1becebe6f574f Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Tue, 12 Dec 2023 11:41:09 +0100 Subject: [PATCH 1/3] feat: add `X-React-Native-Project-Root` header --- packages/dev-server/src/createServer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/dev-server/src/createServer.ts b/packages/dev-server/src/createServer.ts index 565865e3b..cf6510912 100644 --- a/packages/dev-server/src/createServer.ts +++ b/packages/dev-server/src/createServer.ts @@ -91,6 +91,7 @@ export async function createServer(config: Server.Config) { instance.addHook('onSend', async (request, reply, payload) => { reply.header('X-Content-Type-Options', 'nosniff'); + reply.header('X-React-Native-Project-Root', process.cwd()); const [pathname] = request.url.split('?'); if (pathname.endsWith('.map')) { From 9b509c5f7280919d11702f62f7a0d008683b6b93 Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Tue, 12 Dec 2023 13:25:25 +0100 Subject: [PATCH 2/3] fix: use rootDir from config instead of `process.cwd()` --- packages/dev-server/src/createServer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev-server/src/createServer.ts b/packages/dev-server/src/createServer.ts index cf6510912..813c45078 100644 --- a/packages/dev-server/src/createServer.ts +++ b/packages/dev-server/src/createServer.ts @@ -91,7 +91,7 @@ export async function createServer(config: Server.Config) { instance.addHook('onSend', async (request, reply, payload) => { reply.header('X-Content-Type-Options', 'nosniff'); - reply.header('X-React-Native-Project-Root', process.cwd()); + reply.header('X-React-Native-Project-Root', config.options.rootDir); const [pathname] = request.url.split('?'); if (pathname.endsWith('.map')) { From 3af60503af65c221731804cdb73daaf32c826827 Mon Sep 17 00:00:00 2001 From: Jakub Romanczyk Date: Thu, 14 Dec 2023 17:21:34 +0100 Subject: [PATCH 3/3] chore: add changeset --- .changeset/nasty-otters-kiss.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nasty-otters-kiss.md diff --git a/.changeset/nasty-otters-kiss.md b/.changeset/nasty-otters-kiss.md new file mode 100644 index 000000000..390fa832a --- /dev/null +++ b/.changeset/nasty-otters-kiss.md @@ -0,0 +1,5 @@ +--- +"@callstack/repack-dev-server": minor +--- + +Added X-React-Native-Project-Root header, so the RN CLI picks up the running bundler correctly