Skip to content

Improve vite development server config #1007

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

Merged
merged 2 commits into from
May 8, 2025
Merged

Conversation

AlemTuzlak
Copy link
Contributor

@AlemTuzlak AlemTuzlak commented May 8, 2025

There are a few things these PR aims to achieve:

  1. Current setup runs the vite custom server in middleware mode but because we do not specify the appType it's set to SPA which runs HTML transforming middleware which we don't want to do as the "custom" property is the correct type to use (reference here: https://vite.dev/config/server-options.html#server-middlewaremode)

Test Plan

Should work the same as before:

  • local dev server starts normally and everything works

Checklist

  • Tests updated
  • Docs updated

Screenshots

@AlemTuzlak AlemTuzlak requested review from kentcdodds and Copilot May 8, 2025 11:33
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the Vite development server configuration by adjusting middleware settings and port assignment logic, ensuring the custom server runs with the correct appType and handles port collisions as expected. Key changes include:

  • Refining the server startup logic to determine and set the appropriate port.
  • Configuring Vite with the custom appType to bypass unnecessary HTML transformation.
  • Updating the react-router-devtools dependency and adding a request filter in mocks.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/mocks/index.ts Adds a filter to ignore custom requests from react-router-devtools.
server/index.ts Updates Vite dev server configuration with port determination and appType.
package.json Updates the react-router-devtools dependency version.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Thanks!

@kentcdodds kentcdodds merged commit 5f534ee into main May 8, 2025
6 checks passed
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.

2 participants