/bud/hot url points to wp-env host rather than webpack dev host

Hey there, ran into a little snag. I’m working with the main Clover theme that I pulled from a @roots private repo. Originally, the repo didn’t have the enqueue process set up properly, but I sorted that part out and now the assets are loading just as they should.

There is a hiccup though, when in dev environment /bud/hot url does not point to webpack dev server instead it looks like its trying to load it from wp-env host which is localhost:8888. But bud spits out something like that in dev mode inside built dev entry file which I can change manually:

let data = {
    debug: true,
    indicator: true,
    log: true,
    name: `@roots/bud-client`,
    overlay: true,
    // if I change this path to http://localhost:3000/bud/hot it loads properly
    path: `/bud/hot`,
    reload: true,
    timeout: 2000,
};

Is there a way to do that from config?

/**
 * @param {import('@roots/bud').Bud} bud
 */
export default (bud) => {
  bud
    .setPath(`@src`, `resources`)
    .setUrl(3000)
    .setPublicUrl(`http://localhost:3000`)
    .setProxyUrl(3000)
    .setPublicProxyUrl(`http://localhost:3000`)
    .alias(`@editor`, bud.path(`@src`, `editor`))
    .entry(`lt-index`, `@editor/index.js`)
    .minimize(bud.isProduction);
};

Ok guys thanks for attention but I think I have figured it out. I completely forgot the way webpack works and was assuming that it does work same way as vite does (why did I think that?)

export default (bud) => {
  bud
    .setPath(`@src`, `resources`)
    .setUrl(`http://localhost:3000`)
    .setProxyUrl(`http://localhost:8888`)
    .alias(`@editor`, bud.path(`@src`, `editor`))
    .entry(`index`, `@editor/index.js`)
    .minimize(bud.isProduction);
};

I simply had to use localhost:3000 and proxy localhsot:8888 this way all rquests from localhost:3000 appart from built assets are served from localhost:8888

1 Like