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

Vite Dev Server Port Specified in Config Overwritten #19069

Open
tbwrigh opened this issue Mar 28, 2024 · 1 comment
Open

Vite Dev Server Port Specified in Config Overwritten #19069

tbwrigh opened this issue Mar 28, 2024 · 1 comment
Labels
bug Impact: Low Severity: Minor vite Tickets related to vite support

Comments

@tbwrigh
Copy link

tbwrigh commented Mar 28, 2024

Description of the bug

When I attempt to set a port for vite to start on using the vite.config.ts, it is overridden and vite starts on a random free port. This behavior can be tracked directly to the package com.vaadin.base.devserver in the class ViteHandler. Lines 93 and 94 of ViteHandler add the config and lines 95 and 96 following it overwrite the port.

Minimal reproducible example

Create a new vaadin project. In the config.vite.ts set the port by adding:

server {
    port: 8137
}

to the configuration. Build an exploded war, place the exploded war in a tomcat instance's webapps folder, observe, in the logs, that vite is started on a port other than 8137.

Expected behavior

Vite should be started on port specified in config.vite.ts is a port is specified.

Actual behavior

A random free port is chosen and that port is used.

Versions:

- Vaadin / Flow version: This dates back to at least Flow 23 and exists still in Flow 24
- Java version: Java 11 for Flow 23, Java 17 for Flow 24
- OS version: Windows 11, Windows 10, MacOS Sonoma 14.1.2
- Browser version (if applicable): N/A
- Application Server (if applicable): Tomcat 
- IDE (if applicable): N/A
- Development or production mode: Development
- Project from start.vaadin.com or activated in application: activated in application
@tbwrigh tbwrigh added the vite Tickets related to vite support label Mar 28, 2024
@mcollovati
Copy link
Collaborator

There is a vaadin.devServerPort that seems could be used to set a custom port, but currently it does not seem to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Impact: Low Severity: Minor vite Tickets related to vite support
Projects
Status: 🔖 Normal Priority (P2)
Development

No branches or pull requests

2 participants