-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Reload the page after webpack watch compile #3871
Conversation
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.
I'd occasionally find it useful to keep an outdated version of an editor tab active for comparison's sake, but not often enough that this would disrupt my typical workflow.
I do worry a bit since Webpack rebuilds can be very noisy that we could encounter annoyances around unexpected reloads.
Generally I'd be okay with something like this though.
I tried implementing webpack-dev-server but that I didn't crack that this time.
Can you elaborate on the issues you were encountering?
lib/client-assets.php
Outdated
@@ -177,6 +177,13 @@ function gutenberg_register_scripts_and_styles() { | |||
filemtime( gutenberg_dir_path() . 'blocks/build/edit-blocks.css' ) | |||
); | |||
wp_style_add_data( 'wp-edit-blocks', 'rtl', 'replace' ); | |||
|
|||
if ( WP_DEBUG ) { |
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.
Would SCRIPT_DEBUG
be the more appropriate constant here? Based on the description, it seems primarily aimed at toggling minified version, so perhaps not.
https://codex.wordpress.org/Debugging_in_WordPress#SCRIPT_DEBUG
@aduth Because WordPress itself is served by a different web server you have to proxy every request. Once I had that in place I didn't get any further. Webpack dev server wouldn't show console messages that it is trying to reload and the page wouldn't reload at all. (I would also like to add that I have never manually set up a Webpack configuration, so I might not be the best person to take a crack at this. I have asked @xyfi to take another look once he's back from vacation. If you want we could implement a new Gutenberg specific constant like |
This is ready for review. Live reloading can now be enabled by setting the I've also made it possible to customize the port that the livereloading server uses. This is useful when multiple projects support livereloading. This is used like so: |
@atimmer - it was accepted and seems to be useful, can you update and merge? I like that it is optional 👍 |
This could also be helpful to include some note how to use it in CONTRIBUTING document. |
I'm cool with this going in, but I'd want to actually build some stuff with it enabled before we start recommending it to all contributors. |
I tried implementing webpack-dev-server but that I didn't crack that this time. This PR will at least save everyone some F5/Ctrl+R keystrokes.