0

I'm facing an issue on remote development always opening the browser on Server side while I'm developing on client side.

The setup is :

  • a project created with create-react-app on my server machine.
  • a vscode-server remote ssh setup on the same server
  • vscode with remote-ssh plugin on client side
  • BROWSER=none setup in .env project (which is working fine starting the project from the server directly).
  • --no-browser seems to work like BROWSER=none

The thing is, developing in remote with vscode override the BROWSER env conditionnaly to a without-browser-env-var arg seems to be my nemesis.

As far I can investigate I get the process executed in vscode console which seems pass args and it look like that : Running ssh connection command... /Users/hollypony/.vscode-server/bin/hashcode/bin/code-server --start-server --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level off

The main question is: How to stop opening browser on my Server when I start my project through the client ?

Alternative question: There is a way to configure somewhere the --without-browser-env-var arg and how considering ssh environment ?

Note: I've found that display the content of env.BROWSER that refer to : /Users/hollypony/.vscode-server/bin/helpers/browser.sh on react-scripts

EDIT:

  • react-scripts v5.0.1
  • vscode v1.73
  • Remote - SSH v0.96.0
  • Remote - SSH: Editing Configuration Files v0.84.0
  • Remote Explorer v0.2.0

Update 03/03/23

I found a hack editing the "terminal.integrated.env.${targetServerType-osx for me} on the Client vscode settings with value : { "BROWSER": "none" }

This way Im overriding over the override of BROWSER. And as mentionned it's a hack more than a plleasant solution.

HollyPony
  • 817
  • 9
  • 15

1 Answers1

0

Try to modify the start command in your package.json file to include the --no-browser option:

"start": "react-scripts start --no-browser"

This will prevent the the opening of the browser !

  • Seems working like the `BROWSER=none` I mean it work locally no problem but not with the vscode remote which is overrided anyway – HollyPony Mar 03 '23 at 15:45
  • Try to run the command directly from terminal in vscode remote before adding it to package.json and see if it works – EL Amine Bechorfa Mar 03 '23 at 16:31
  • I got the same result. Browser on server still opening a new tab – HollyPony Mar 03 '23 at 17:04
  • I've edit the post to add a hack. As you can see this is reallly not a react-script/create-react-app issue which is working fine but a true vscode env override of BROWSER var while on client/server relation. – HollyPony Mar 03 '23 at 17:21