You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the watch mode (npm run build:watch) starts immediately and triggers a build on the first run. This can cause issues in cases where:
The serve command starts before the initial build is complete.
The doc folder (or equivalent) does not exist prior to the build, leading to a 404 error when the serve command runs.
Currently, there is no built-in way to skip the initial run in watch mode and only trigger builds on subsequent file changes.
Use Case
Developers often need to ensure that the doc folder (or other build artifacts) is present before starting the server. For example:
npm run build ensures that the doc folder exists.
npm run build:watch watches for changes and rebuilds as needed.
npm run serve serves the doc folder but should not start before the first build is complete.
Without the ability to skip the first build in watch mode, there is a race condition between the build and serve commands, causing issues for the user.
Proposed Solution
Introduce an option or flag (e.g., --skip-first-build) for the watch mode to skip the initial execution and only run on subsequent file changes.
Simplifies the development workflow by avoiding race conditions.
Reduces the need for custom workarounds or scripts.
Provides a more intuitive experience for users running common dev setups.
Additional Context
This feature would be especially useful for projects where build artifacts are required before serving, such as:
Static site generators
Projects using bundlers or transpilers
Applications with a multi-step build process
Thank you for considering this feature request!
The text was updated successfully, but these errors were encountered:
hichemfantar
changed the title
Add Option to Skip First Run in Watch Mode
Feature: Add Option to Skip First Run in Watch Mode
Jan 23, 2025
hichemfantar
changed the title
Feature: Add Option to Skip First Run in Watch Mode
Feature: Add Option to Skip Initial Build in Watch Mode
Jan 23, 2025
Problem
When running a development script like the following:
the watch mode (
npm run build:watch
) starts immediately and triggers a build on the first run. This can cause issues in cases where:serve
command starts before the initialbuild
is complete.doc
folder (or equivalent) does not exist prior to the build, leading to a 404 error when theserve
command runs.Currently, there is no built-in way to skip the initial run in watch mode and only trigger builds on subsequent file changes.
Use Case
Developers often need to ensure that the
doc
folder (or other build artifacts) is present before starting the server. For example:npm run build
ensures that thedoc
folder exists.npm run build:watch
watches for changes and rebuilds as needed.npm run serve
serves thedoc
folder but should not start before the firstbuild
is complete.Without the ability to skip the first build in watch mode, there is a race condition between the
build
andserve
commands, causing issues for the user.Proposed Solution
Introduce an option or flag (e.g.,
--skip-first-build
) for the watch mode to skip the initial execution and only run on subsequent file changes.Example:
This would:
Workaround
Currently, developers must rely on custom scripts or tools to handle this, which adds unnecessary complexity. For example:
https://stackoverflow.com/questions/42495826/webpack-watch-with-skip-initial-build
Benefits
Additional Context
This feature would be especially useful for projects where build artifacts are required before serving, such as:
Thank you for considering this feature request!
The text was updated successfully, but these errors were encountered: