Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize configuration changes required to run dev server inside a container #7536

Closed
4 tasks done
koyadume opened this issue Mar 31, 2022 · 2 comments
Closed
4 tasks done

Comments

@koyadume
Copy link

koyadume commented Mar 31, 2022

Clear and concise description of the problem

At this moment it requires to adjust a number of configuration parameters in order to run dev server inside a container vs running it directly on your local setup. I believe many of these adjustments can be eliminated by following few things -

base

  • If I am specifying a value for this config parameter, it means my dev server will be running behind a proxy because that is the only scenario where I need to use a non default value for this config. In such scenarios we can set the value of server.host property to 0.0.0.0 so that one need not to specify this explicitly.
  • (Optional) server.port can be set to 80 so that one need NOT to adjust this while running application in development vs production modes inside a k8s cluster.
  • Dev server should always serve index.html file at / instead of value of base config parameter. This will eliminate need of defining different url rewrite rules while running an application in development vs production modes inside a k8s cluster.

hmr - Use location.port on the browser side for hmr.clientPort which will set it to correct value no matter dev server is running behind a proxy or not. This will eliminate the need of specifying hmr.clientPort when dev server is running behind a proxy.

The whole idea is that developers should focus on writing the code instead of figuring out appropriate values for different configurations parameters to run an application across different types of setups (local development, remote development (on a k8s cluster), production etc).

Suggested solution

Mentioned in the problem description

Alternative

No response

Additional context

No response

Validations

@sapphi-red
Copy link
Member

related: #4116

@bluwy
Copy link
Member

bluwy commented Jun 25, 2022

  • If I am specifying a value for this config parameter, it means my dev server will be running behind a proxy because that is the only scenario where I need to use a non default value for this config. In such scenarios we can set the value of server.host property to 0.0.0.0 so that one need not to specify this explicitly.

Not sure if this best as as base can now be set as ./ to generate relative paths in builds (embedded deployments).

  • Dev server should always serve index.html file at / instead of value of base config parameter. This will eliminate need of defining different url rewrite rules while running an application in development vs production modes inside a k8s cluster.

This could be confusing for non-proxy setups though.

hmr - Use location.port on the browser side for hmr.clientPort which will set it to correct value no matter dev server is running behind a proxy or not. This will eliminate the need of specifying hmr.clientPort when dev server is running behind a proxy.

I believe #8650 resolved this.

Perhaps better documentation is needed as and if we plan so we should follow #4116

@vitejs vitejs locked and limited conversation to collaborators Jun 25, 2022
@bluwy bluwy converted this issue into discussion #8780 Jun 25, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

3 participants