extension-js / extension.js

🧩 The cross-browser extension framework.
https://extension.js.org
MIT License
3.73k stars 93 forks source link

hot-reloading doesn't remove old versions of content scripts #207

Open Hades32 opened 2 weeks ago

Hades32 commented 2 weeks ago

If I change e.g. the number in this content script (yes, it's only one line), then the browser does reload, but now I get two log lines, one for the old and one for the new version

Also a full reload of the page doesn't fix this

content script

console.log("hello from TWITCH 3 content_scripts");

version

"extension": "^2.0.0-beta.1"

Manifest snippet

  "content_scripts": [
    {
      "matches": [
        "https://twitch.tv/*",
        "https://*.twitch.tv/*"
      ],
      "js": [
        "content/twitch-script.ts"
      ]
    },
    {
      "matches": [
      "https://youtube.com/*",
      "https://*.youtube.com/*"
      ],
      "js": [
        "content/youtube-script.ts"
      ]
    }
  ]
cezaraugusto commented 2 weeks ago

hi @Hades32, thanks for reporting. are you using the TypeScript template? please share the tsconfig.json/typescript version if not so I can take a closer look

Hades32 commented 2 weeks ago

yes, I was using the content-typescript template, but just to be sure, that's the file

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "isolatedModules": true,
    "jsx": "react-jsx",
    "lib": ["dom", "dom.iterable", "esnext"],
    "moduleResolution": "node",
    "module": "esnext",
    "noEmit": true,
    "resolveJsonModule": true,
    "strict": true,
    "target": "esnext",
    "verbatimModuleSyntax": true,
    "useDefineForClassFields": true,
    "skipLibCheck": true
  },
  "include": ["./"],
  "exclude": ["node_modules", "dist"]
}

and the TS version

        "typescript": "^5.4.2",
cezaraugusto commented 2 weeks ago

thanks, on it