Skip to content
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

Use ROLLUP_WATCH instead of NODE_ENV #720

Merged
merged 1 commit into from
Dec 2, 2024
Merged

Use ROLLUP_WATCH instead of NODE_ENV #720

merged 1 commit into from
Dec 2, 2024

Conversation

emersion
Copy link
Member

We want to enable the livereload plugin when running in watch mode. We don't want to enable the livereload plugin when building, because that causes the build to hang forever.

NODE_ENV is the wrong tool for the job here: it can be set to "development" even when running npm run build, for instance if the user has set it globally (on a dev machine). In general, NODE_ENV is just supposed to indicate whether a Node.js app is running in production - nothing else.

Instead, use the ROLLUP_WATCH env var: it's set by rollup specifically when started in watch mode.

We want to enable the livereload plugin when running in watch mode.
We don't want to enable the livereload plugin when building, because
that causes the build to hang forever.

NODE_ENV is the wrong tool for the job here: it can be set to
"development" even when running `npm run build`, for instance if
the user has set it globally (on a dev machine). In general, NODE_ENV
is just supposed to indicate whether a Node.js app is running in
production - nothing else.

Instead, use the ROLLUP_WATCH env var: it's set by rollup specifically
when started in watch mode.

Signed-off-by: Simon Ser <contact@emersion.fr>
@emersion emersion requested review from Yohh and Math-R November 25, 2024 10:09
@emersion emersion requested a review from a team as a code owner November 25, 2024 10:09
@emersion emersion changed the title all: use ROLLUP_WATCH instead of NODE_ENV Use ROLLUP_WATCH instead of NODE_ENV Nov 25, 2024
Copy link
Contributor

@Yohh Yohh left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@Math-R Math-R left a comment

Choose a reason for hiding this comment

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

seems logic, lgtm !

@emersion emersion added this pull request to the merge queue Dec 2, 2024
Merged via the queue into dev with commit d7e6f07 Dec 2, 2024
6 checks passed
@emersion emersion deleted the rollup-watch-env branch December 2, 2024 14:09
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