FredKSchott / snowpack

ESM-powered frontend build tool. Instant, lightweight, unbundled development. ✌️
https://www.snowpack.dev
MIT License
19.48k stars 922 forks source link

🐛 BUG: css.proxy.js files do not receive updates with `snowpack build --watch` #3784

Open smnhgn opened 3 years ago

smnhgn commented 3 years ago

Quick checklist

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the bug

Projects which are set up with snowpack and @snowpack/plugin-sass and directly import sass files in js (or ts) will generate css.proxy.js files in their build output. With snowpack build --watch the css.proxy.js files will not receive updates after changes to the sass files.

Steps to reproduce

  1. set up project with snowpack and @snowpack/plugin-sass
  2. import sass file in js (or ts) import "./index.scss"
  3. run build with watch flag snowpack build --watch
  4. change contents of sass file (index.scss) body { background: blue; } -> body { background: red; }
  5. check build output
  6. css output (index.css) received update
    body { background: red; }
  7. css proxy output (index.css.proxy.js) did not receive update

    if (typeof document !== 'undefined') {
    const code = "body {\n  background: blue;\n}";
    
    const styleEl = document.createElement("style");
    const codeEl = document.createTextNode(code);
    styleEl.type = 'text/css';
    styleEl.appendChild(codeEl);
    document.head.appendChild(styleEl);
    }

Link to minimal reproducible example (optional)

https://github.com/smnhgn/snowpack-css-proxy-bug

Beyarz commented 3 years ago

Having the same issue, I can't import the sass file to App.jsx

JohnForster commented 2 years ago

This is still an issue.