File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
packages/dev-middleware/src/utils Expand file tree Collapse file tree 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';
1414const { spawn} = require ( 'child_process' ) ;
1515const ChromeLauncher = require ( 'chrome-launcher' ) ;
1616const { Launcher : EdgeLauncher } = require ( 'chromium-edge-launcher' ) ;
17+ const open = require ( 'open' ) ;
1718
1819/**
1920 * Default `BrowserLauncher` implementation which opens URLs on the host
@@ -31,15 +32,15 @@ const DefaultBrowserLauncher: BrowserLauncher = {
3132 // Locate Chrome installation path, will throw if not found
3233 chromePath = ChromeLauncher . getChromePath ( ) ;
3334 } catch ( e ) {
35+ // Fall back to Microsoft Edge
3436 chromePath = EdgeLauncher . getFirstInstallation ( ) ;
37+ }
3538
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 ;
4344 }
4445
4546 const chromeFlags = [ `--app=${ url } ` , '--window-size=1200,600' ] ;
You can’t perform that action at this time.
0 commit comments