File tree 1 file changed +8
-7
lines changed
packages/dev-middleware/src/utils
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import type {BrowserLauncher} from '../types/BrowserLauncher';
14
14
const { spawn} = require ( 'child_process' ) ;
15
15
const ChromeLauncher = require ( 'chrome-launcher' ) ;
16
16
const { Launcher : EdgeLauncher } = require ( 'chromium-edge-launcher' ) ;
17
+ const open = require ( 'open' ) ;
17
18
18
19
/**
19
20
* Default `BrowserLauncher` implementation which opens URLs on the host
@@ -31,15 +32,15 @@ const DefaultBrowserLauncher: BrowserLauncher = {
31
32
// Locate Chrome installation path, will throw if not found
32
33
chromePath = ChromeLauncher . getChromePath ( ) ;
33
34
} catch ( e ) {
35
+ // Fall back to Microsoft Edge
34
36
chromePath = EdgeLauncher . getFirstInstallation ( ) ;
37
+ }
35
38
36
- if ( chromePath == null ) {
37
- throw new Error (
38
- 'Unable to find a browser on the host to open the debugger. ' +
39
- 'Supported browsers: Google Chrome, Microsoft Edge.\n' +
40
- url ,
41
- ) ;
42
- }
39
+ if ( chromePath == null ) {
40
+ // Fall back to default browser - the frontend will warn if the browser
41
+ // is not supported.
42
+ await open ( url ) ;
43
+ return ;
43
44
}
44
45
45
46
const chromeFlags = [ `--app=${ url } ` , '--window-size=1200,600' ] ;
You can’t perform that action at this time.
0 commit comments