daniti's avatar

Mixed content error in HMR with Laravel mix 6

Almost got the hot module replacement to work with a local https domain on Valet, but once I make a change, the HMR module calls the new file over http instead of https, resulting in an error. How do I force the HMR to use https?

In my package.json I have "hot": "mix watch --hot".

In webpack.mix.js, I added this (slightly different then what I used with previous versions), but seems to work

[...]
const fs = require("fs");
const path = require("path");

const homeDir = process.env.HOME;
const host = process.env.APP_URL.split("//")[1];

mix.webpackConfig({
    devServer: {
        https: {
            key: fs.readFileSync(
                path.resolve(homeDir, `.config/valet/Certificates/${host}.key`)
            ),
            cert: fs.readFileSync(
                path.resolve(homeDir, `.config/valet/Certificates/${host}.crt`)
            ),
        },
    },
});

I hope you can help, this is driving me nuts 😁

0 likes
1 reply
SebSob's avatar

Have you tried to add --https to the hot command? "mix watch --hot --https"

Please or to participate in this conversation.