Okay so I’m trying Sage9 for the first time and I’m probably doing something wrong.
Here’s what I’ve done:
Retrieved a copy of Sage9 using Composer as directed here
run yarn to install dependencies
updated devURL in assets/config.json as instructed
run yarn run build and yarn run start (and yarn run clean a few times to see if that would fix anything)
Here’s what happens:
Templates reload just fine when I save a change, but, while Browsersync indicates that it’s rebuilding and inserting updated styles when changes to .scss files are saved, the styles do not appear in the browser.
I also get a bunch of notifications and errors in my js console:
I couldn’t recall if I had tried updating publicPath, so I just did and re-ran yarn run build and yarn run start and I’m still getting 404s for those files, now with the correct theme path.
I can also confirm that those .json files are not in /dist/, but I don’t know if they’re actually supposed to be.
Same here, php and js changes are updated as should be in browser sync, but not scss files (I added scss files to the watcher obviously). Changes are detected and compiled by web pack but nothing happens in the browser.
Tried with the change to assets/build/webpack.config.watch.js mentioned above and I still get the weird response in my terminal when running yarn run start.
Also my css changes aren’t updated while my files are being watched. Maybe I have to do a reinstall?
Your CSS changes won’t be echoed in terminal the way they were in Sage 8; you should see a note in the actual browser window about “rebuilding” and then the styles should update. Are you also not seeing that?
Thanks for your answer! I’m seeing the “webpack rebuilding” notification in the top right corner when I make a change but it’s not actually reflected on the website I’m building, not even after a hard refresh.
Maybe my settings are wrong? I’m using laravel valet in development.
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_2__util_Router__[false] is not a constructor
at Object.<anonymous> (main.js:23)
at Object.<anonymous> (main.js:27)
at __webpack_require__ (bootstrap f2d9dd8…:659)
at fn (bootstrap f2d9dd8…:83)
at Object.<anonymous> (tether.js:1811)
at __webpack_require__ (bootstrap f2d9dd8…:659)
at bootstrap f2d9dd8…:708
at bootstrap f2d9dd8…:708
Can you remove your node_modules folder, make sure yarn.lock is the same as what’s on the Sage repo, and re-run yarn?
@ben Just removed node_modules, replaced yarn.lock and re-run yarn.
Got this from yarn at terminal warning Incorrect peer dependency "webpack@^2.1.0-beta.19".
That peer dependency warning is expected. The 404 for the CSS is also expected on a Browsersync session no matter what.
What you’re looking for:
The error I mentioned above
Saving a file (make a styling change) and then doing a manual refresh after BS claims it injected the changes
If you start a BS session and immediately don’t see the __WEBPACK_IMPORTED_MODULE_2__util_Router__[false] is not a constructor error in your console, then I’m assuming your node_modules don’t match up with what is expected from the yarn.lock file
I have just updated the publicPath in assets/webpack.config.watch.js and I can confirm I am receiving the exception warning: Uncaught TypeError: WEBPACK_IMPORTED_MODULE_3__util_Router[false] is not a constructor but it reads differently, in that it says “MODULE_3” . Not sure if this matters, but I could not also get the styling to refresh.
I entered the command "yarn run start"
Edited an SCSS file
Refreshed the window in incognito mode, Browsersync did not refresh.
All very confusing. I realised that I had added the line “assets/styles/**/*.scss” to “assets/watch.json” under “watch”. So I removed that line, relaunched “yarn run start” and the refresh solution works for me now. I take it I was not supposed to add that in the watch section? Just thought I would add a message to help anybody else that is new to the yarn/webpack setup that does the same.