PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.48k stars 365 forks source link

[RFC] Support TRUE HMR for content scripts? #755

Open yunsii opened 1 year ago

yunsii commented 1 year ago

How do you envision this feature/change to look/work like?

After my test and investigation, plasmo content scripts only support live-reloading, but chrome-extension-tools supported TRUE HMR.

I am not familiar with parcel, is it possible for parcel used in this framework to support TRUE HMR like vite used in chrome-extension-tools?

What is the purpose of this change/feature? Why?

If business logic become more and more complex, live-reloading is not a good practice.

(OPTIONAL) Example implementations

No response

(OPTIONAL) Contribution

Verify canary release

Code of Conduct

yunsii commented 1 year ago

BTW, I found that the RFC issue template refered to plasmo@canary, but it looks like there is no related packages?

louisgv commented 1 year ago

@yunsii We don't use the canary tag anymore.

In term of CS HMR - can you point out how they did it? We have true HMR for react only. For vue/svelte, the framework doesn't have the HMR mechanic yet. (PR welcome!)

yunsii commented 1 year ago

We have true HMR for react only.

It means true HMR for non-CS React HMR? I have a exmple like this: https://github.com/yunsii/janna-webext/blob/d8309d9eca73fcd6eb1681c6f498cb7ad2a1ecdf/src/contents/react.tsx#L7 After I update this file, it only reload page roughly.