-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Scripts: coerce live reload port to integer #29196
Scripts: coerce live reload port to integer #29196
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @emilio-martinez! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
Thank you for your contribution. The proposed change makes sense. I had only a minor styling comment. Side note: Live reload will eventually get replaced by React Fast Refresh as explored in #28273. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, it's ready to go. Thank you!
Congratulations on your first merged pull request, @emilio-martinez! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
Description
Attempting to use
process.env.WP_LIVE_RELOAD_PORT
was not working for me. After some debugging, I realizedwebpack-livereload-plugin
must not expect to receive a port argument of astring
type, failing silently to take the desired port, and perprocess.env
docs:Additionally, the use of the logical OR operator would prevent passing a
0
value, precluding the use of the followingwebpack-livereload-plugin
functionality:This PR aims to remedy this by parsing
process.env.WP_LIVE_RELOAD_PORT
before passing the value towebpack-livereload-plugin
.How has this been tested?
Validated by running these changes against a local project. Before the change, running
wp-scripts start
would always log one of the two below:Live Reload listening on port 35729
Live Reload disabled: listen EADDRINUSE: address already in use :::35729
(for parallel processes run)After the changes in this PR, the appropriate port will be used — including the use of a
0
value.Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: