HRM Bud.js not working in Sage+Bedrock. 404 at proxy and 200 in serve but not reload

Hi,

First of all, thanks for the great work done in root.

I’m wordking with Laravel Homestead to develop in local a bedrock+sage proyect.

When I run “npm run dev” compiles it, but not whatch any changes. In serve url (http://192.168.10.10:3005) HMR is connected but not reloading.

Request URL: http://192.168.10.10:3005/__bud/hmr
Request Method: GET
Status Code: 200 OK
Remote Address: 192.168.10.10:3005
Referrer Policy: strict-origin-when-cross-origin

While in proxy url get a 404 errror

Request URL: http://my-site.local/__bud/hmr
Request Method: GET
Status Code: 404 Not Found
Remote Address: 192.168.10.10:80
Referrer Policy: strict-origin-when-cross-origin

As you can see, time to compile is extremelly hight and not are shown “watching for changes” in terminal.

> dev
> bud dev

⠋ 98% emitting

◯  js/app.js         248.07 kB
◯  js/editor.js      220.94 kB
◯  manifest.json     170 bytes
◯  entrypoints.json  61 bytes
◯  wordpress.json    33 bytes
◯  images/.gitkeep   0 bytes

duration  22s 304ms

mode        development  hash     b30fe7ba61c1e5d837ec
@roots/bud  6.3.3        webpack  5.73.0
node        16.16.0

server url:  http://192.168.10.10:3005/
proxy url:   http://my-site.local/

webpack built bud b30fe7ba61c1e5d837ec in 22304ms

This is the build compile for context, where you can see how the first time to proccess is under 2s:

> build
> bud build

⠹ 98% emitting

◉  css/app.78bd48.css      8.41 kB
◉  js/runtime.8eb29a.js    1.02 kB
◉  js/editor.790afc.js     376 bytes
◉  js/575.baac18.js        232 bytes
◉  js/app.3c1997.js        222 bytes
◉  css/editor.31d6cf.css   0 bytes
◯  manifest.json           277 bytes
◯  entrypoints.json        220 bytes
◯  wordpress.json          33 bytes
◯  images/.gitkeep.31d6cf  0 bytes

duration  24s 987ms (1s 404ms + 23s 583ms)

mode        production  hash     91b91d8343451b5ac422
@roots/bud  6.3.3       webpack  5.73.0
node        16.16.0

This is my package.json:

{
  "name": "sage",
  "private": true,
  "browserslist": [
    "extends @roots/browserslist-config/current"
  ],
  "engines": {
    "node": ">=16.0.0"
  },
  "scripts": {
    "dev": "bud dev",
    "build": "bud build",
    "translate": "yarn translate:pot && yarn translate:update",
    "translate:pot": "wp i18n make-pot . ./resources/lang/sage.pot --include=\"app,resources\"",
    "translate:update": "for filename in ./resources/lang/*.po; do msgmerge -U $filename ./resources/lang/sage.pot; done; rm -f ./resources/lang/*.po~",
    "translate:compile": "yarn translate:mo && yarn translate:js",
    "translate:js": "wp i18n make-json ./resources/lang --pretty-print",
    "translate:mo": "wp i18n make-mo ./resources/lang ./resources/lang"
  },
  "devDependencies": {
    "@roots/bud": "6.3.3",
    "@roots/bud-sass": "^6.3.5",
    "@roots/bud-tailwindcss": "6.3.3",
    "@roots/sage": "6.3.3"
    },
  "dependencies": {
    "@alpinejs/collapse": "^3.10.3",
    "@fortawesome/fontawesome-svg-core": "^6.1.2",
    "@fortawesome/free-brands-svg-icons": "^6.1.2",
    "@fortawesome/pro-light-svg-icons": "^6.1.2",
    "@fortawesome/pro-solid-svg-icons": "^6.1.2",
    "@glidejs/glide": "^3.5.2",
    "alpinejs": "^3.10.3"
  }
}

And this is my bud.config.mjs:

/**
 * Build configuration
 *
 * @see {@link https://bud.js.org/guides/getting-started/configure}
 * @param {import('@roots/bud').Bud} app
 */
export default async (app) => {
  app
    /**
     * Application entrypoints
     */
    .entry({
      app: ["@scripts/app", "@styles/app"],
      editor: ["@scripts/editor", "@styles/editor"],
    })

    /**
     * Directory contents to be included in the compilation
     */
    .assets(["images"])

    /**
     * Matched files trigger a page reload when modified
     */
    .watch([
      'tailwind.config.cjs',
      'resources/views/**/*', 
      'resources/styles/**/*', 
      'app/**/*'
    ])

    /**
     * Proxy origin (`WP_HOME`)
     */
    .proxy("http://my-site.local")

    /**
     * Development origin
     */
    .serve("http://192.168.10.10:3005")

    /**
     * URI of the `public` directory
     */
    /* Set public path */
    // .setPublicPath(app.isDevelopment ? "/" : "")
    .setPublicPath(app.isDevelopment ? "/app/themes/my-site/public/" : "app/themes/my-site/public/")
};

Could you see where is the problem here? I’ve been trying to figuring this out for and entire day, reading all topics related but nothing work.

I’have also installed a fresh install of bedrock+sage with nothing extra installed and same problem comes up.

The 404 on the proxy is expected.

The long compilation and dev issues are not.

can you run yarn bud dev --log and post anything interesting from the http or proxy loggers? the stuff we’re mostly interested in will come after the build output in console.

webpack built bud 1466c03a90ea0c5af425 in 920ms  <-- from here down
[http] › ❯  [200] /

@robrecord this seems related to the issue you mentioned on discord?

Nothing is shown in console after the point you mark. After “proxy url: …” shows this information:

rules
css        `postcss`, `css`, `precss`
cssModule  `postcss`, `cssModule`, `precss`
csv        `csv`
font
html       `html`
image
js         `babel`
json
svg
toml
webp
xml        `xml`
yml        `yml`
sass       `sass`, `resolveUrl`, `postcss`, `css`, `precss`

cache
type   filesystem
ident  kv2hsdehcogacvnppmr1y5otvhw_

extensions
`@roots/bud-cache/invalidate-cache`      `@roots/bud-terser`
`esm`                                    `cdn`
`webpack:provide-plugin`                 `webpack:define-plugin`
`webpack:hot-module-replacement-plugin`  `clean-webpack-plugin`
`copy-webpack-plugin`                    `webpack-manifest-plugin`
`mini-css-extract-plugin`                `webpack-remove-empty-scripts`
`@roots/bud-sass`                        `@roots/bud-sass/resolve-url`
`@roots/bud-postcss`                     `@roots/bud-tailwindcss`
`@roots/sage`                            `@roots/sage/acorn`
`@roots/sage/wp-theme-json`              `@roots/bud-preset-wordpress`
`@roots/bud-entrypoints`                 `@roots/bud-preset-recommend`
`@roots/bud-wordpress-externals`         `@roots/bud-wordpress-dependencies`
`@roots/bud-wordpress-manifests`         `@roots/bud-terser/css-minimizer`
`@roots/bud-babel`                       `@roots/bud-preset-wordpress/browserslist-check`
`@roots/bud-react`                       `@roots/bud-react/react-refresh`
`@roots/bud-react/babel-refresh`         `bud-cdn-gist`
`bud-cdn-github`                         `bud-cdn-unpkg`
`bud-cdn-skypack`

webpack built bud 8f5d172234caf5274b1e in 13162ms

Nothing else… I’ve made some changes to check whether HRM works but not…

May I give you more information to check it out?

Thanks!!

Hi there,

I checked it out more thorougly and not findong the problem yet. But I give you more context to it in case it helps…

I run “bub doctor” and this is the message:

Checking configuration...

✅ production configuration is valid
✅ development configuration is valid


Checking dependencies...

Done in 12.22s.

No problems in config detected.