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';
11
11
import Store from 'src/devtools/store' ;
12
12
import { getSavedComponentFilters , getAppendComponentStack } from 'src/utils' ;
13
13
import { Server } from 'ws' ;
14
+ import { join } from 'path' ;
14
15
import { existsSync , readFileSync } from 'fs' ;
15
16
import { installHook } from 'src/hook' ;
16
17
import DevTools from 'src/devtools/views/DevTools' ;
@@ -258,9 +259,10 @@ function startServer(port?: number = 8097) {
258
259
httpServer . on ( 'request' , ( request , response ) => {
259
260
// NPM installs should read from node_modules,
260
261
// 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
+ }
264
266
265
267
// Serve a file that immediately sets up the connection.
266
268
const backendFile = readFileSync ( `${ basePath } /dist/backend.js` ) ;
You can’t perform that action at this time.
0 commit comments