crxjs / chrome-extension-tools

Bundling Chrome Extensions can be pretty complex. It doesn't have to be.
https://crxjs.dev/vite-plugin
2.75k stars 182 forks source link

.tsx files don't seem to reload #624

Closed rbhalla closed 1 year ago

rbhalla commented 1 year ago

Build tool

Rollup

Where do you see the problem?

Describe the bug

When making a change to certain .tsx files I am not seeing the built files get an update.

It seems to be happening in a very odd scenario though, read reproduction for steps.

Reproduction

https://github.com/rbhalla/crxjs-bug-repro/tree/tsx-not-updating

Use npm run dev to get started. Open the src/ContextWrapper.tsx in the dist folder and keep an eye on it. Open the original and make a trivial change (I've included a console.log to be changed).

It will not update the dist file. There are two ways I've found to fix this: 1) Remove the foo function being exported. I've noticed that you need to hit save twice before this reflects in the dist file. From then on, all changes in that file will be immediate.

2) Remove the Wrapper reference in src/main.tsx on line 14 and 16. I have no idea why this is the case, but when you do that, changes to ContextWrapper start saving properly.

Logs

No response

System Info

System:
    OS: macOS 12.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 1.67 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 15.10.0 - ~/.nvm/versions/node/v15.10.0/bin/node
    npm: 7.5.3 - ~/.nvm/versions/node/v15.10.0/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Safari: 16.0
  npmPackages:
    @crxjs/vite-plugin: ^1.0.14 => 1.0.14
    vite: ^2.9.0 => 2.9.15

Severity

annoyance

karlhorky commented 1 year ago

@rbhalla did the following PR by @jacksteamdev resolve this issue?

If so, maybe this issue can be closed now?

rbhalla commented 1 year ago

Hi @karlhorky, unfortunately I've been unable to test since the codebase I'm using this library with is not on the beta tag.

I'm happy to close this though since the PR does directly address this problem. I'll reopen if necessary.