-
-
Couldn't load subscription status.
- Fork 10.7k
Copy server.watch config option from vite.config.(ts|js) to child vite server in development mode
#14298
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
base: dev
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: c0f6e4f The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Hi @c0va23, Welcome, and thank you for contributing to React Router! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
|
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
config option from vite.config.(ts|js)` to child vite server in development modeserver.watch config option from vite.config.(ts|js) to child vite server in development mode
3c6eef8 to
b9e3f7f
Compare
Co-authored-by: Peter Neave <[email protected]>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 5 to 6. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v5...v6) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
b9e3f7f to
c0f6e4f
Compare
Hi!
Issue
As my
react-router-based (latest release version) project grew, I encountered the following error when runningreact-router(as an Express.js app) in development mode:Output of `npm run dev`
Invistigation
undefinedvalue to the watch option of the Vite server, which enabled the watch mode: https://github.com/vitejs/vite/blob/bcc31449c0c4f852ccb1eedda1842bc7ded23d01/packages/vite/src/node/server/index.ts#L493undefeinedwatch option falls back to an empty watch option, which causes starting the Vite server with default config: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/watch.ts#L57Vitewith thereactRouter()plugin is trying to subscribe to all files in the project dir with some hard-coded exceptions: https://github.com/vitejs/vite/blob/bcc31449c0c4f852ccb1eedda1842bc7ded23d01/packages/vite/src/node/watch.ts#L58Solution
In my simple solution, I just copied the
server.watchoption from thevite.config.(ts|js)config to the Vite server inside thereactRouter()plugin to respect the project config within.My small fix solves this problem. Also, my fix sped up the development server startup time several times (from ~1 minute to ~10 seconds).
A project context
For the context, some files from my project can be relevant to the issue:
Content of `server.js`
Content of `vite.config.ts`
Content of `scripts/utilities/ignore-file.mjs`