chrome-extension-tools icon indicating copy to clipboard operation
chrome-extension-tools copied to clipboard

Hot Reload not working for (some) scripts not included in manifest.json

Open nmilev-scribe opened this issue 2 years ago • 1 comments

Build tool

Vite

Where do you see the problem?

  • [x] In the browser
  • [x] In the terminal

Describe the bug

My manifest states several content scripts, all of which import from other files. Some of these scripts are React, but some are plain Javascript/Typescript. For React, hot reload works fine, but whenever I change some code in a file imported in other content scripts, I see a page reload, but the executed code remains the same.

Reproduction

In manifest.ts:

...
content_scripts: [
        {
            matches: ['<all_urls>'],
            js: ['src/scripts/some-content/index.js'],
            all_frames: true,
            run_at: 'document_end',
        }
    ]
...

In some-content/index.js:

...
import { someFunction } from 'src/someModule';
...
someFunction();
...

Upon changing the code of someFunction, I see a page reload, but nothing in the terminal, and the function someFunction doesn't change behaviour.

Logs

No response

System Info

System:
    OS: macOS 13.3.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 922.84 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 8.5.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 113.0.5672.92
    Edge: 112.0.1722.68
    Firefox: 112.0
    Safari: 16.4

Severity

annoyance

nmilev-scribe avatar May 16 '23 14:05 nmilev-scribe

Also ran into the same issues when creating an offscreen script.

dokudoki avatar Jul 13 '23 23:07 dokudoki