Search code examples
nuxt.jswebpack-hmr

Nuxt - How can I remove the [HMR] logs from the console


With nuxt, every time I save any of my files, my console gets flooded with [HMR] messages. Often cluttering up most of the log levels, making it hard to see actual console output.

One of few approaches I have found is to clear the console. On reload. However, this approach does not fit my needs and seems excessive to stop these messages.

Another approach was to disable autoConnect however, this led to other issues.

Filtering out the messages in the browser, still let multiple HMR messages come through, and would not be persistent. Plus it has the added downside of cluttering up the filter.

Does anyone else have any ideas?


Solution

  • Try adding the following to nuxt.config.js -> build

    hotMiddleware: {
      client: {
        noInfo: true,
      },
    },
    

    This should disable the messages from being printed to the browser console.


    Full Example

    // Build Configuration: https://go.nuxtjs.dev/config-build
    build: {    
      // Disable HMR messages
      hotMiddleware: {
        client: {
          noInfo: true,
        },
      },
    },