I am getting chunkload errors in dev mode with a simple custom block with a slider (block generated with acf-composer)
This is the relevant code:
bud.config.mjs
export default async (app) => {
app
.entry({
app: ["@scripts/app", "@styles/app"],
editor: ["@scripts/editor", "@styles/editor"],
mySlider: ["@scripts/blocks/mySlider", "@styles/blocks/mySlider"]
})
.assets(["images"])
.watch(["resources/views/**/*", "app/**/*"])
.proxy("https://mysite.lndo.site")
.serve("http://0.0.0.0:3000")
.setPublicPath("/app/themes/my-theme/public/");
};
mySlider.php
namespace App\Blocks;
use Log1x\AcfComposer\Block;
use StoutLogic\AcfBuilder\FieldsBuilder;
use function Roots\bundle;
class mySlider extends Block
{
[...]
public function enqueue()
{
bundle('mySlider')->enqueue();
}
mySlider.js
import Swiper from "swiper/bundle";
console.log("my slider");
const swiper = new Swiper('.swiper', {
on: {
init: function () {
console.log('swiper initialized');
},
},
loop: true,
autoplay: {
delay: 3000,
},
slidesPerView: 1,
spaceBetween: 0
});
mySlider.js
uses Swiper.js
:
package.json
"devDependencies": {
"@roots/bud": "6.3.5",
"@roots/bud-postcss": "^6.3.5",
"@roots/bud-sass": "^6.3.5",
"@roots/bud-tailwindcss": "^6.3.5",
"@roots/sage": "6.3.5",
"swiper": "^8.3.2"
},
The slider block works fine, but when I am in dev mode on a page with that block, I get these errors whenever I change something in mySlider.js
as well as in app.js
.
Uncaught (in promise) ChunkLoadError: Loading hot update chunk app failed.
(missing: http://localhost:3000/app.facbdb7be62296078d5a.hot-update.js
However, that chunk is in my public folder
When the block is not on the page I don’t get these errors
I’m on the lastest Sage with Bud 6.3.5