Changes to build.rs do not restart the development server or queue worker

Open Beginner friendly
#162 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
83/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, rust
Domain
devtools

Research direction

Start by reading the dev:server and dev:queue script definitions and compare their watch lists with the root Cargo.toml entry. The issue reports that both omit build.rs and that adding it makes each process restart once. Update the scripts to watch the root build script, then verify edits to build.rs restart both processes.

Written by the indexing model from the issue text.

Description

When an application uses its root build.rs to set a compile-time value, changing that value leaves the running development server on the previous build until another watched file changes.

Reproduced on Linux using the dev:server script from 0.x (46f28287), the locked Nodemon 3.1.11, and a small Rust HTTP app built by Cargo:

  1. In build.rs, emit println!("cargo::rustc-env=DEMO_LABEL=first"); and return env!("DEMO_LABEL") from a route. Start npm run dev:server and request the route. It returns first.
  2. Change first to second in build.rs and save. After two seconds, the route still returns first.
  3. Touch src/main.rs without changing the handler. The server rebuilds and the same route now returns second.

The starter's dev:server and dev:queue scripts both omit build.rs from their explicit watch lists. In a separate restart-count test, editing build.rs triggered neither process. Adding --watch build.rs to both scripts made each restart once. Could the development scripts watch the root build script alongside Cargo.toml?

Dominant language
Rust
Stars
2.2k
Forks
105
Avg merge
7h 19m
Merged PRs (30d)
41

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from laravel/rust

All issues in laravel/rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.