Skip to content
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

feat(server): add strict-port option #1453

Merged
merged 2 commits into from
Jan 11, 2021

Conversation

stafyniaksacha
Copy link
Contributor

@stafyniaksacha stafyniaksacha commented Jan 9, 2021

Add server strict port option

See #1425

Enable strict port

exit with code 1 if port is already in use

cli

$ vite --strict-port

error when starting dev server:
Error: Port 3000 is already in use

vite.config.ts

import { defineConfig } from 'vite'

export default defineConfig({
  server: {
    port: 3000,
    strictPort: true,
  },,
})

Todo

  • Tests
  • Update documentation

@yyx990803
Copy link
Member

Not quite sure about the name - what does "sticky" mean in this context? 🤔

@stafyniaksacha
Copy link
Contributor Author

stafyniaksacha commented Jan 10, 2021

I was thinking that sticky is a synonym of fixed, my bad ....
Hum, I'd like to have a one word option for this, but I can't find one.
What about --fixed-port, --enforce-port or --no-dynamic-port ?
I like the idea of --no prefix because it disables something

@yyx990803
Copy link
Member

Maybe --bail?

@smhmd
Copy link
Contributor

smhmd commented Jan 11, 2021

strict instead of sticky?

@yyx990803
Copy link
Member

Ah, --strict-port sounds good and explicit.

@stafyniaksacha stafyniaksacha changed the title feat(server): add sticky-port option feat(server): add strict-port option Jan 11, 2021
@yyx990803 yyx990803 merged commit 0501084 into vitejs:main Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants