Jonghakseo / chrome-extension-boilerplate-react-vite

Chrome Extension Boilerplate with React + Vite + Typescript
MIT License
2.22k stars 322 forks source link

HMR does not work on Content Scripts Change #404

Closed hhimanshu closed 4 months ago

hhimanshu commented 6 months ago

Describe the bug The HMR does not work when working with Content Scripts. The reload of the page is required to view the changes

To Reproduce Here is the PR that has changes required to setup TailwindCSS in hope to have HMR working on Content Scripts https://github.com/hhimanshu/chrome-ext/pull/6

Expected behavior As a developer, when I make changes to code, or tailwind style in Content Script, the web page should reflect the change immediately without requiring the page reload

Screenshots

https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite/assets/6589036/398c73f0-621d-4a2b-941e-f69666a82529

Desktop (please complete the following information):

Additional context When a change is made, there is an activity on the terminal, but the outcome does not have the change.

github-actions[bot] commented 6 months ago

Thank you for your contribution. We will check and reply to you as soon as possible.

Jonghakseo commented 6 months ago

hello. Thanks for the report.

I received the code you provided in the link and ran it and found that HMR works fine.

https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite/assets/53500778/ad55cd0a-1a74-4760-9a7a-cd54eb4758d6

After run pnpm dev, Could you reload extension in chrome://extensions/ tab?

스크린샷 2024-03-02 오후 4 17 50
PatrykKuniczak commented 6 months ago

That's issue with 'Brave'

This browser can't establish connection: image

On the first render work's well, but after fully loaded, immediately i have info about browser can't establish websocket connection and don't refreshing page, work's as you describe.

That's not issue with Twind or other styles issue, only with this connection.

PatrykKuniczak commented 6 months ago

@hhimanshu For now, develop in Google Chrome, maybe @Jonghakseo will fix it in the future

Or if you're able to contribute, you can try to solve it, we can help you, mention us here, if you get stuck