Roots Discourse

LaravelMix HMR not working in docker

Hi all,

I have been working on a minimal easy to use docker-compose setup for sage10. Everything is working great but no HMR :confused: webpack.mix.js is working fine compiling and so on, but in the browser just keep reloading. I’ve tried a couple fixes found here in the forum and stack-overflow but it didn’t not work.

All the code is in the Github repo

my mix file looks like this:

const mix = require('laravel-mix');
require('@tinypixelco/laravel-mix-wp-blocks');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Sage application. By default, we are compiling the Sass file
 | for your application, as well as bundling up your JS files.
 |
 */

mix.setPublicPath('./public').browserSync('https://localhost');

mix
  .sass('resources/styles/app.scss', 'styles')
  .sass('resources/styles/editor.scss', 'styles')
  .options({
    processCssUrls: false,
    postCss: [require('tailwindcss')],
  });

mix
  .js('resources/scripts/app.js', 'scripts')
  .js('resources/scripts/customizer.js', 'scripts')
  .blocks('resources/scripts/editor.js', 'scripts')
  .autoload({ jquery: ['$', 'window.jQuery'] })
  .extract();

mix
  .copyDirectory('resources/images', 'public/images')
  .copyDirectory('resources/fonts', 'public/fonts');

mix.webpackConfig({
  devServer: {
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    watchOptions: {
      poll: true,
    },
    disableHostCheck: true,
  },
});

mix.sourceMaps().version();

Any feedback to improve the setup beside the hmr thing also would be appreciate it :slight_smile: