deryck's avatar

Can't make work Hot Module Replacement with browserSync proxy

Hi,

I have the following code in webpack.mix.js

mix.js('src/app.js', 'dist/').sourceMaps().sass('src/app.scss', 'dist/');
mix.browserSync(
    {
        files: [
            'src/**/*',
            'components/**/*',
            'index.php'
        ],
        proxy: 'wordpress.local',
        browser: ["google chrome canary"],
        https: false

    }
);

If I run npm watch task:

"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",

Works fine!

If I try to use npm hot task with HMR

"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",

I get:

events.js:161
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND localhost
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

I'm running vue inside a WordPress Theme. Works fine, with what, but HMR does not. :( and it's a lot faster to use HMR.

What can I do?

Thanks.

0 likes
0 replies

Please or to participate in this conversation.