From what I can tell the path to the chunk isn’t written correctly, though I’m not too sure how to remedy it. Since bud rewrites requests to the chunks when using the dev server it doesn’t matter that the chunks are requested from the root url, in your case http://undo-dev.local/, but when built and run from production the chunk needs to be referenced relative to the theme/public folder, which it obviously isn’t.
You may be able to set __webpack_public_path__ using bud.setPublicPath | bud.js where it would look something like this I believe
This has got the JS working now thank you!! Life saver.
However now my image files path is doubling up to look like http://undo-dev.local/wp-content/themes/undo/public/wp-content/themes/undo/public/images/footer/terra-carta.svg
I am using blade icons so can resort to using this for my icons for now until I find a solution for assets.
If you have any idea on that it would be a great help! If not no worries.
So I just noticed in the budj.s blog here that setPublicPath is deprecated when using Sage. Searched around on here a bit more and found this post that gives a couple options.
I think option #2 is cleaner and would do something like this, note the following is untested
Automatic public path works in dev and production mode without defining it with webpack magic variables or in the entry object (as of 5.7.6, iirc).
Getting WordPress and Webpack to use an automatic public path that worked for dev and production wasn’t as trivial as you’d think. In the end, we ended up getting bud and acorn to coordinate with one another using http headers when in dev and used an empty string in production (basically, same as webpack auto).