vue-loader icon indicating copy to clipboard operation
vue-loader copied to clipboard

remove console.log('reload') from hotReload.js or create a config variable to disable them

Open Anubarak opened this issue 4 years ago • 0 comments

What problem does this feature solve?

Not sure if this is a bug report or a feature request - actually it's none of them. I would just like to have those two debug statements removed from the code.

// __VUE_HMR_RUNTIME__ is injected to global scope by @vue/runtime-core

export function genHotReloadCode(
  id: string,
  templateRequest: string | undefined
): string {
  return `
/* hot reload */
if (module.hot) {
  __exports__.__hmrId = "${id}"
  const api = __VUE_HMR_RUNTIME__
  module.hot.accept()
  if (!api.createRecord('${id}', __exports__)) {
    console.log('reload') // <----- here
    api.reload('${id}', __exports__)
  }
  ${templateRequest ? genTemplateHotReloadCode(id, templateRequest) : ''}
}
`
}

function genTemplateHotReloadCode(id: string, request: string) {
  return `
  module.hot.accept(${request}, () => {
    console.log('re-render') // <----- here
    api.rerender('${id}', render)
  })
`
}

Anubarak avatar Oct 07 '21 12:10 Anubarak