-
Notifications
You must be signed in to change notification settings - Fork 58
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
HMR Doesn't Work On Local By Flywheel Sites #5
Comments
Same issue |
Hi, could you zip your extension and share it here so I can take a look? Thanks! |
divi-modules.zip Is there a plan to release a Dev version of Divi 3.1, with all the JSX files? |
Looks like our published tutorial is missing a step that is actually on our dev copy of the docs. Sorry about that. I updated the tutorial. Just look for the step that says:
Let me know if that solves it for you. |
Hmm..the errors in the console indicate your module's javascript is not being loaded. Do you have the |
I do have the same issue. yarn start is running. |
Yup, it's running.
|
Could you post a screenshot of the network tab of the developer console? |
The port number is necessary for the hot reloading to work. Basically when you make changes to the code it automatically updates the page. Are you using the docker environment? If so, did you run |
@odoremieux It looks like there is an issue with the webpack-dev-server not serving your javascript files. Maybe its not able to get port 3000 on your system? |
I'm using local by Flywheel. Running yarn start from the command line on a console |
Currently the extension code expects that the javascript bundle will be served from the same host as the wordpress site. In the case of Local By Flywheel the wordpress site is served from a docker container while the javascript bundle will be served from your localhost. We'll look into making necessary changes so that it will work in the future. In the meantime you can get it working locally by adding this to your extension's php class: /**
* Enqueues non-minified, hot reloaded javascript bundles.
*
* @since 3.1
*/
protected function _enqueue_debug_bundles() {
// Frontend Bundle
$site_url = wp_parse_url( get_site_url() );
$hot_bundle_url = "http://localhost:3000/static/js/frontend-bundle.js";
wp_enqueue_script( "{$this->name}-frontend-bundle", $hot_bundle_url, $this->_bundle_dependencies['frontend'], $this->version, true );
if ( et_core_is_fb_enabled() ) {
// Builder Bundle
$hot_bundle_url = "http://localhost:3000/static/js/builder-bundle.js";
wp_enqueue_script( "{$this->name}-builder-bundle", $hot_bundle_url, $this->_bundle_dependencies['builder'], $this->version, true );
}
} |
I'm using local by Flywheel too. and i can confirm that
is working |
It's working for me too. Thanks. |
When I see the console, i got this
Is there something to worry about? |
I think you copied the method immediately after I posted it but it had a mistake in it so I edited it like 1 minute later 😅 |
Opps! My bad for not reading. All I think was getting it to work first. |
No worries 😆 |
Got this on the console as well.
Not sure what it does but i believe it's from webpackHotDevClient |
Weird 🤔 Does it show up every time you load the builder while |
The debug constant is automatically set in |
I am getting the same error as above, just the function call in the visual builder rather than the text that should be there. Is there any solution to this yet? |
Still using flywheel (demo.local) I added the code from the comment, however I am still getting an error. place the snippet at plugins/new-module/NewModule.php (DiviExtension Class) Other tries: also tried adding it to the module itself (But I read it should only be added to DiviExtension Class. additional errors VB ERROR
|
The answers in this thread are quite cryptic for someone who maybe won't know the difference between module class/extension class so here's what I did:
However the hot reloading still doesn't work so you have to refresh the page every time you want to see the change:
|
I'm getting this below code displayed in the visual builder, even after pasting this code @lots0logs #5 (comment)
|
The same to me , I have pasted the same snippet described in here: #5 (comment) But error is still appearing OK And It works now! |
@vidalem can you please help me in understanding what Hermitzan is saying. I'm not understanding it. Thank you. |
Where is Thank you |
I think what they are saying is make sure the wp-config.php file contains |
How is that going to affect, those are commented lines? Thank you |
@kannan6240 the javascript file that manages |
@Hermitzan Thank you, Pal. You are amazing. |
I had the same issue, |
Thanks for the tutorial, man.
When I run
To which I respond, yes. I see that the regex in In Chrome browser, the issue appears to persist (even after Looks fine in Firefox and Safari. Resolved after |
Came back to this after a few months and same issue where yarn is running on an alternate port because docker is using My workaround at the moment has been to update the port in the I picked Feels pretty hacky. Is there a better solution? |
Spoke too soon. That's giving a Cross-Origin request issue trying to get Some workarounds here: https://medium.com/swlh/avoiding-cors-errors-on-localhost-in-2020-5a656ed8cefa |
I'm having wp-config error when I use bash terminal. Try to use cmd or https://prnt.sc/10nkap3 |
Same to me. It solves the problem but I'm wondering if there's other solution. I'm not so comfortable running this command in a development space. Thoughts? |
Change "Happy blogging" to "Happy publishing". (without quotes) Try doing this. @rmtux |
Thanks @kannan6240 , it worked!
|
EDITED (twice): My issue isn't with 'yarn build' but with 'yarn start'. #5 (comment) by @rmtux works for me because it suggests 'yarn build' In my case, my issue is I'm using namespacing on my extension and module classes of PHP. I removed namespacing and used long-winded class names, including the prefix of the class as defined in package.json (probably the key part of all this) and it worked! |
EDITED to add this: Using Flywheel Local on Windows OK - I fixed it on my system. Change the two lines that define $hot_bundle_url and get rid of the localhost. Make them look like this:
The beginning of my class definition file now looks like this:
It would be REALLY GREAT if ET updated this functionality so it works with current releases of the underlying technology without having to muck around a bunch :( |
One thing ... remember you can't mix http and https, if you're on debug mode with yarn start, open your wordpress site using http (not https). Otherwise you'll get the error all of you are mentioning, no matter what you do on code (i.e. an https site trying to load http assets). |
I'm also using Local by Flywheel and this comment solved my problem of only having the module function printed in the Divi edit screen. Thanks @Hermitzan! |
Is this a bug report?
Followed the steps on Developer Documentation. starting yarn start and editing the name etc. No error showing when compiling. However, went to VB choose Simple Header and it shows
function (t){return s.a.createElement(p.a,g({rawContentProcesser:_.a.replaceCodeContentEntities},e.props))}
Browser console also showing:
any ideas?
The text was updated successfully, but these errors were encountered: