After many times of getting it to work, given the many different errors I’ve gotten (infinite reloading on browser, ignoring scss changes, ignoring javascript changes and both of them at once among them), right now I’m at a loss.
It was working fine, when I started editing an already existing scss file. Make my changes, save the file and got linter errors, solve them all, and no change… Strange. Try to change another file… same again. Is this framework so fragile? I mean it’s impossible to work with it.
Anyone with similar experiences?
Just to clarify, config.json is configured as it should, and the build works fine. It’s just the feeding of changes to webpack, which is not consistent.
EDIT: I’ve done composer clear-cache, followed by composer install on the theme folder, and it works yet again.
Hey, when I get the chance I’ll edit this post with all the info you mentioned, but just as an advance, it’s a docker environment, compounded of different images. nginx, mysql, node, two for composer (bedrocks and sage separately, which just take care of installing/updating vendor libs).
The node one, is tasked with starting webpack, with yarn start (straight from the docs). Then config.json publicPath is path to then (with bedrocks naming).
And as said, I’ll be more specific when I get the chance.
Also, I think it’s worth noting that with a clean setup, both scss, and js compiling worked fine. Yet as soon as I started adding .scss or .js files, it stopped working as it should.
What URL are you trying to access the site at? Is it from the Nginx container or the Node one?
Your config.json looks correct. Sage uses Browsersync to proxy your devUrl (http://nginx) so you can access it at the proxyUrl (http://localhost:3000). If you tried to access it at the devUrl after that would explain the lack of updates to scripts + styles, since Sage attaches an HMR client to just the proxyUrl. You shouldn’t use the devUrl to view the site after you’ve ran yarn start.
There is a readme.md file. If you follow the first section Quickstart you should be up and running in a matter of minutes.
Check the .env file on the root project folder, and set the variables to your user UID and GID. (This command should give them to you: echo $(id -u):$(id -g)).
So, at src/web/app/themes/test/resources/assets/scripts/routes/common.js, you can try to add a console.log, and saving the file (maybe try removing it again) and wbpack should stop working as expected soon enough if not right away, in our case it’s infinite reload loop.
Also you can try to do docker-compose up nginx and changing "devUrl": "http://nginx", to "devUrl": "http://localhost", and running webpack locally with yarn start on the theme folder. to discard docker problems. In our case, it doesn’t work either.
Please let us know, if you find anything wrong.
Thanks in advance.
I’m having the exact same issue, except not with docker.
My dev environment: MacOS Mojave, Valet, node 11.2.0, Firefox 64.0.2
[Only] When saving a javascript file, the browser starts reloading infinitely. The console then returns this error before reloading: The connection to http://localhost:3000/__webpack_hmr was interrupted while the page was loading.
and probably more if you continue to search. I’m locking this thread as it’s old (and you’re also not using Docker), and you should be able to figure out the solution from existing threads. If you can’t figure it out, please start a new topic!