create-react-extension icon indicating copy to clipboard operation
create-react-extension copied to clipboard

hot reload broken in v3

Open mehimanshupatil opened this issue 3 years ago • 0 comments

@VasilyShelkov , I migrated the extension to v3. After migration, hot reload of background js script is broken. When I change background.js file, I see this error in the service_worker inspect view.

background.bundle.js:10849 Uncaught TypeError: self.location.reload is not a function
    at Object.contentChanged [as content-changed] (background.bundle.js:10849)
    at background.bundle.js:11092
    at WebSocket.<anonymous> (background.bundle.js:10704)
contentChanged @ background.bundle.js:10849
(anonymous) @ background.bundle.js:11092
(anonymous) @ background.bundle.js:10704

My manifest file

  "manifest_version": 3,
  "version": "0.0.1",
  "short_name": "React App",
  "name": "Same React App",
  "description": "Sample application showing how to create an extension with Create React App",
  "action": {
    "default_title": "CRE",
    "default_popup": "popup.html"
  },
  "background": {
    "service_worker": "background.bundle.js"
  },
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["contentScript.bundle.js"]
    }
  ],
  "icons": {
    "16": "img/icon-16.png",
    "48": "img/icon-48.png",
    "128": "img/icon-128.png"
  },
  "options_page": "options.html",
  "permissions": ["tabs"],
  "content_security_policy": {
    "extension_pages": "script-src 'self'; object-src 'self'"
  }
}

I have tried deleting dev folder too. Any suggestions?

Originally posted by @rashid301 in https://github.com/VasilyShelkov/create-react-extension/issues/19#issuecomment-991500692

mehimanshupatil avatar Dec 24 '21 05:12 mehimanshupatil