File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/react-devtools-core/src Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import Bridge from 'src/bridge';
1111import Store from 'src/devtools/store' ;
1212import { getSavedComponentFilters , getAppendComponentStack } from 'src/utils' ;
1313import { Server } from 'ws' ;
14+ import { join } from 'path' ;
1415import { existsSync , readFileSync } from 'fs' ;
1516import { installHook } from 'src/hook' ;
1617import DevTools from 'src/devtools/views/DevTools' ;
@@ -258,9 +259,10 @@ function startServer(port?: number = 8097) {
258259 httpServer . on ( 'request' , ( request , response ) => {
259260 // NPM installs should read from node_modules,
260261 // But local dev mode needs to use a relative path.
261- const basePath = existsSync ( './node_modules/react-devtools-core' )
262- ? 'node_modules/react-devtools-core'
263- : '../react-devtools-core' ;
262+ let basePath = join ( __dirname , 'node_modules/react-devtools-core' ) ;
263+ if ( ! existsSync ( basePath ) ) {
264+ basePath = '../react-devtools-core' ;
265+ }
264266
265267 // Serve a file that immediately sets up the connection.
266268 const backendFile = readFileSync ( `${ basePath } /dist/backend.js` ) ;
You can’t perform that action at this time.
0 commit comments