Skip to content

Improve vite development server config#1007

Merged
kentcdodds merged 2 commits intomainfrom
improvements_to_dev_server
May 8, 2025
Merged

Improve vite development server config#1007
kentcdodds merged 2 commits intomainfrom
improvements_to_dev_server

Conversation

@AlemTuzlak
Copy link
Copy Markdown
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 Copilot and kentcdodds May 8, 2025 11:33
Copy link
Copy Markdown

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
Copy Markdown
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
mohammedzamakhan referenced this pull request in mohammedzamakhan/epic-startup Aug 4, 2025
@kody-bot kody-bot deleted the improvements_to_dev_server branch March 24, 2026 21:05
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