I would update to 5.7.0. We ended up forking webpack-hot-middleware
to address some issues with dev rebuilds not working after syntax errors.
You can also remove @roots/bud-postcss
from your devDependencies
. It’s already included as a peer by @roots/sage
. I don’t think this makes much of a difference viz a viz yr problem, however.
Last thing, unless you are doing something specific I don’t know about, I’m not sure what this does:
.assets(['images'], ['fonts'])
but you probably want:
.assets(['images', 'fonts'])
Other than that, I don’t know what to say. In my testing bud is significantly faster than mix, and your build shouldn’t be slow like that at all.
With all of your dependencies installed and imported into app.js
:
import foundation from "foundation-sites";
import swiper from "swiper";
import * as isInViewport from "is-in-viewport";
import jquery from "jQuery";
const main = async () => {
console.log({ foundation, jquery, swiper, isInViewport });
};
main()
import.meta.webpackHot?.accept(main);
and importing all of foundation-sites
into app.scss
and editor.scss
:
@import "foundation-sites/dist/css/foundation.css";
I end up with some pretty bloated bundles but it’s all pretty much going just about as fast as webpack can:
│ ✔ vendor/app vendor/app.js 1.1 MB
│ ✔ editor editor.js 205.98 kB
│ ✔ app app.js 205.03 kB
│ ✔ vendor/bud.app.editor vendor/bud.app.editor.js 49.96 kB
│ ✔ ᠃ manifest.json 146 bytes
│ ✔ ᠃ entrypoints.json 125 bytes
│ ✔ ᠃ wordpress.json 41 bytes
duration 254ms
mode development hash 9675348b4e1d1b67d32f
bud 5.7.0 webpack 5.70.0
5.6.2 is a similar story:
duration 286ms
mode development hash 52ad18ff4610f33e2b4d
bud 5.6.2 webpack 5.68.0
I wish I could be of any help here, but I’m at a loss as to why your experience is going the way it is. But, try updating to 5.7.0 and that should at least address your HMR issues.