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

Allows NodeJS to terminate also if there is an active service. #656

Merged
merged 4 commits into from
Jan 12, 2021
Merged

Allows NodeJS to terminate also if there is an active service. #656

merged 4 commits into from
Jan 12, 2021

Conversation

SalvatorePreviti
Copy link
Contributor

@SalvatorePreviti SalvatorePreviti commented Jan 9, 2021

Issue #659

Curently, NodeJS will not terminate if there is an esbuild service running.

Running this, will not allow NodeJS to exit.

const esbuild = require('esbuild');
esbuild.startService();

This pull request allows the possibility to keep the esbuild service running in background ready to receive requests without the need to manually call stop() - NodeJS will terminate automatically when there is no operation in progress (transform, build or serve).

See https://nodejs.org/api/child_process.html#child_process_subprocess_unref for more technical details.

This change should not affect the normal usage, and will allow the implementation of features like experimental module loaders without hanging the NodeJS process and without resorting to restarting the child process every transformation. Will also simplify the usage of this library by bundler and build tools.

More than happy to discuss this.
And thank you again for esbuild!

Copy link
Owner

@evanw evanw left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

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.

2 participants