feat: public
option and --host
flag to disable network expose in development by default
#98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Linked issue
resolves #88
β Type of change
π Description
This PR introduces a new
public
option (available as--host
cli flag implicitly with vite cli consistancy) that controls whether by default we should listen to the public network interfaces or not.If the option is not explicitly being set, we infer it first by checking (explicit)
hostname
if beinglocalhost
to disable and then fallback to env check and only enable public by default for production (more compatibility) and disable for development (more security).I suppose this is a safe nonbreaking change especially since we keep production behavior as-is, support and show
--host
flag and anyway main consumers (nuxt and nitro) are introducing this feature in the non major version. But also open to make development default and release a major version if too much trouble in the ecosystem happened which I guess won't unless there is a special complex setup. /cc @danielroe @antfuπ Checklist