Bud - Upgrading to 5.2.0 causing problems

@erip2, it seems there are two separate issues in the app code you provided.

The first was that it wouldn’t compile because of a bad import in editor.js. The bad import was the cause of the compilation failure and with my fix (removing the import) it compiles again in CI and locally.

I looked back into it when you said you were still having problems and ultimately could reproduce your browser error.

The issue in the application code is that you are dynamically loading modules and so you need to dynamically set the public path.

I merged an addition to my earlier PR that includes an application level fix for this. The code works in the browser now.

Ultimately, you need to do two things:

  1. This is kind of optional but recommended. Define the publicPath in your bud.config.js file. Make sure to escape the value. I did it with bud.env but you can use env or just add it as a string. Whatever works.
    /**
      * Define the public path for dynamically imported assets.
      *
      * I am defining it an .env file and accessing it with `bud.env`.
      */
     .define({
       ASSET_PATH: JSON.stringify(app.env.get('ASSET_PATH')),
     })
  1. Set __webpack_public_path__:
// eslint-disable-next-line no-undef
__webpack_public_path__ = ASSET_PATH;

I did this in a separate module which was imported to the top of app.js intentionally since it works for literally all setups (newer esmodule imports will break if you just add it at the top of the entrypoint).

see bud documentation on bud.define:

and the documentation from webpack on publicPath: