yosevu / react-content-script

An starter project to build Chrome extensions using React and TypeScript. Ideal for developers looking to create efficient and modern Chrome extensions with a focus on a clean development workflow using Vite and crxjs.
211 stars 58 forks source link

how can make content script to be hot reload? #20

Closed zhuliminl closed 1 month ago

Toumash commented 3 months ago

Should work by default with crxjs@beta

devlopersabbir commented 2 months ago

You can use this extension Extensions Reloader, I'm using this extension more then 2 years. 🙂

Toumash commented 2 months ago

For some reason:

image

This extension may soon no longer be supported because it doesn't follow best practices for Chrome extensions.

crxjs@beta (currently 25 patch version) works perfecly with hot reload. For the hot reload (hot module replacement) to work with vite you need to have file export only one component. To remember this you can use eslint rule: https://github.com/ArnaudBarre/eslint-plugin-react-refresh

yosevu commented 1 month ago

HMR should work in latest version. See https://crxjs.dev/vite-plugin/getting-started/react/content-script-hmr for instructions and let me know if it still doesn't.