[Vuejs]-HMR doesn't work since the vue cli plugins update (v5)

0👍

My team could fix it by adding the optimization object to our webpack config (in vue.config.js):

const { defineConfig } = require('@vue/cli-service');

module.exports = defineConfig({
    /* your config */
    configureWebpack: {
        optimization: {
            runtimeChunk: 'single',
        },
    },
    devServer: {
        proxy: `https://${process.env.SANDBOX_HOSTNAME}/`, // we need this for apollo to work properly
        host: '0.0.0.0',
        allowedHosts: 'all',
    },
});

It fixed the HMR for us, however if you’re using firefox your console might be still spammed by error messages like these: The connection to wss://SANDBOX_HOSTNAME:8080/ws was interrupted while the page was loading.

Leave a comment