Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

fix: changed the Vite port to the new Vite default port 5173 #792

Merged
merged 3 commits into from Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/frameworks/vite.json
Expand Up @@ -9,7 +9,7 @@
},
"dev": {
"command": "vite",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ascorbic, I thought about this one some more, and since this is the default if they have nothing configured, we can explicitly set it to "command": "vite --port 5173",? That way anyone who was using it previously won't run into any issues and new folks won't run into issues either.

If we were to use an environment variable, we'd have to use a vite config to consume it to set the port. The only problem with this is there's a disconnect between the command and the port fields, although this is a minor issue. We could also remove the --port 5173 at some point since most people will probably have updated at some point.

Thoughts?

I thought about this again and explicitly adding the port could be more problematic. I think just tearing the bandaid off and notifying folks in support as well as Discords about the port change might be a better way. And again, the CLI will mention to configure targetPort in your netlify.toml if it's waiting.

➜ vite-broken-with-ntl 

dev/issues/vite-broken-with-ntl on ξ‚  main [!?] via  v16.15.1 
➜ ntl dev
β—ˆ Netlify Dev β—ˆ
β—ˆ Ignored general context env var: LANG (defined in process)
β—ˆ Starting Netlify Dev with Vite

> vite-broken-with-ntl@0.0.0 dev
> vite


  VITE v3.0.2  ready in 195 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  Network: use --host to expose
β ™ Waiting for framework port 3000. This can be configured using the 'targetPort' property in the netlify.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this message with SvelteKit first changed and was not immediately aware that it couldn't find a port. It became clear eventually, but this message is stalled out. Is there a way to error out if it doesn't find one in a specific amount of time?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @brittneypostma , erroring out after a specified amount of time would be useful so it removes the perception of 'hanging' and a useful error message can help the user troubleshoot a bit better with respect to the expected port for the framework

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think the timeout makes sense. Just wondering what makes sense in terms of time taking into account not everyone is running an M1. Maybe 30 seconds and make the message clearer? And if it fails to find it, we can add an error message like you suggested @ericapisani.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 30 seconds and make the message clearer?

I'm not sure if this is too aggressive, but I wonder if we would want to make the timeout a bit shorter (10-15 seconds) as I imagine that folks will ctrl/cmd+c the process sooner in the 30 second time frame πŸ€” I'm not sure if we have any data to provide some guidance on this for us though so we can make a more informed decision

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 10-15 seconds may be too aggressive given that not everyone is running an M1. I think if we do 30 and make the message clearer about the port we should be good alongside the port change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on @seldo's comments in Slack, i.e. "People are overwhelmingly on version 3", I think it's safe to flick the switch to port 5173 and folks on older versions will get the port warning the CLI provides.

"port": 3000,
"port": 5173,
"pollingStrategies": [{ "name": "TCP" }]
},
"build": {
Expand Down