Polling with Bud

Hey there,

I’m trying to set up a Vagrant box for development with Sage, however because of the way that folder syncing works, bud / webpack does not pick up the file changes.

Is there a quick way to set up polling in my bud.config.js?

I’ve tried the following:
.options.set(‘webpack.watchOptions.poll’, true)

However, this gives me an error when running yarn dev.
TypeError: app.entry(…).assets(…).watch(…).options.set is not a function

Here’s my entire bud.config.js for reference:

module.exports = async (app) => {
  app
    /**
     * Application entrypoints
     *
     * Paths are relative to your resources directory
     */
    .entry({
      app: ['@scripts/app', '@styles/app'],
      editor: ['@scripts/editor', '@styles/editor'],
    })

    /**
     * These files should be processed as part of the build
     * even if they are not explicitly imported in application assets.
     */
    .assets('images')


    /**
     * These files will trigger a full page reload
     * when modified.
     */
    .watch('resources/views/**/*', 'app/**/*')

    .options.set('webpack.watchOptions.poll', true)

    /**
     * Target URL to be proxied by the dev server.
     *
     * This should be the URL you use to visit your local development server.
     */
    .proxy('http://kineepik.local')

    /**
     * Development` URL to be used in the browser.
     */
    .serve('http://192.168.0.10:3000');
};

:thinking: where did you get this snippet?

There is a hook for this, though:

bud.hooks.on('dev.watch.options', options => ({
  ...options,
  usePolling: true,
}))
1 Like

Thanks @kellymears

I have tried adding a hook in my bud.config.js, both before and within the sage-provided app calls and also before them. However nothing results in polling. Checking .budfiles/webpack.config.js, I never see the polling option added.

Am I doing it in the wrong place?

Can you post your bud.config.js with your non-functional attempt to add this hook?