repack icon indicating copy to clipboard operation
repack copied to clipboard

v3 debugger-app won't start in Windows

Open DaveWelling opened this issue 2 years ago • 0 comments

Environment

Running in windows with Node v16.15.1

Description

I tried to get v3 running locally so I could test this out, but I'm having some difficulty. I tried simply installing @callstack/repack@next and I also tried running from code (by sym-linking in node-modules). Whenever I try to start the devserver using npx react-native webpack-start or cross-env PLATFORM=android npx react-native webpack-start I get the following:

! [18:52:53.938Z][DevServer] "root" path "/C:/temp/junk/pocFixRnDebugging/DreadfulProject/node_modules/@callstack/repack-debugger-app/dist" must exist
i [18:52:53.969Z][DevServer] Server listening at http://127.0.0.1:8081
i [18:52:54.460Z][DevServer] Hermes device connected { deviceId: 0 }
i [18:52:54.471Z][DevServer] Hermes device connected { deviceId: 1 }
i [18:53:02.739Z][DevServer] Route GET:/debugger-ui not found { reqId: 'req-1' }
i [18:53:02.743Z][DevServer] GET 404 /debugger-ui request completed { responseTime: 6.202500015497208 }
x [18:53:02.774Z][DevServer] Cannot detect platform { reqId: 'req-2' }
i [18:53:02.777Z][DevServer] GET 400 /favicon.ico request completed { responseTime: 3.4616000056266785 }

I sort of looks like it might be a windows problem based on the path? When I look at the code for the repack-debugger-app it looks like it is returning a path for this dev server to consume, but I guess that isn't working in windows?

import { URL } from 'url';

export default new URL('./dist', import.meta.url).pathname;

If I replace that with this:

export default 'C:\\temp\\junk\\pocFixRnDebugging\\DreadfulProject\\node_modules\\@callstack\\repack-debugger-app\\dist';

and also fix the template (templates/webpack.config.cjs ) line 94 to have __dirname instead of dirname then I am able to build.

Reproducible Demo

I create a repo branch for you: See repack3 branch in: https://github.com/DaveWelling/pocFixRnDebugging.git

DaveWelling avatar Aug 12 '22 19:08 DaveWelling