Skip to content

Commit

Permalink
feat: add X-React-Native-Project-Root header (#475)
Browse files Browse the repository at this point in the history
* feat: add `X-React-Native-Project-Root` header

* fix: use rootDir from config instead of `process.cwd()`

* chore: add changeset

---------

Co-authored-by: Jakub Romańczyk <[email protected]>
  • Loading branch information
szymonrybczak and jbroma authored Dec 14, 2023
1 parent c60d88a commit cc997a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/nasty-otters-kiss.md
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions packages/dev-server/src/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', config.options.rootDir);

const [pathname] = request.url.split('?');
if (pathname.endsWith('.map')) {
Expand Down

0 comments on commit cc997a2

Please sign in to comment.