const injectLivereload = () => {
  const script = document.createElement("script")
  script.setAttribute("src", "http://localhost:35729/livereload.js")
  document.head.appendChild(script)
}

browser.runtime.onMessage.addListener(msg => {
  switch (msg.command) {
    case "inject":
      injectLivereload();
      break;
    default:
      break;
  }
})

true
const injectLivereload = () => {
  const script = document.createElement("script")
  script.setAttribute("src", "http://localhost:35729/livereload.js")
  document.head.appendChild(script)
}

const removeLivereload = () => {
  const elems = document.querySelectorAll("script[src='http://localhost:35729/livereload.js']")
  elems.forEach(s => s.remove())
}

browser.runtime.onMessage.addListener(msg => {
  switch (msg.command) {
    case "inject":
      injectLivereload();
      break;
    case "remove":
      removeLivereload();
      break;
    default:
      break;
  }
})

true
--- 
+++ 
@@ -2,11 +2,6 @@
   const script = document.createElement("script")
   script.setAttribute("src", "http://localhost:35729/livereload.js")
   document.head.appendChild(script)
-}
-
-const removeLivereload = () => {
-  const elems = document.querySelectorAll("script[src='http://localhost:35729/livereload.js']")
-  elems.forEach(s => s.remove())
 }
 
 browser.runtime.onMessage.addListener(msg => {
@@ -14,9 +9,6 @@
     case "inject":
       injectLivereload();
       break;
-    case "remove":
-      removeLivereload();
-      break;
     default:
       break;
   }
Remove livereload script tag removing

Removing the script tags does not remove the code from running, so this
has no value.
