PlasmoHQ / plasmo

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

getStyle: PlasmoGetStyle api unable to get live-reload effect. #949

Open deng232 opened 3 months ago

deng232 commented 3 months ago

content.tsx:

import styleText from  "data-text:./styles.css"
import type { PlasmoGetStyle } from "plasmo"
function Overlay(){
    return (
        <div className="overlay">
                Test
        </div>
    )
}
export const getStyle: PlasmoGetStyle = () => {
    const style = document.createElement("style")
    style.textContent = styleText
    return style
  }

export default Overlay

when styles.css update, there is extension re-packaged message show, but no effect on "overlay" unless reload extension.

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contribution

Code of Conduct

Jonathan-Asher commented 2 months ago

Facing same issue... Also for content scripts there is no HMR, the whole page just reload (and the extension as well)

Changing CSS/SCSS does not trigger the reload.

I belive related: https://github.com/PlasmoHQ/plasmo/issues/610#issuecomment-1579781474

Jonathan-Asher commented 2 months ago

Started using Tailwind CSS for the hot reloading!