Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Css modules don't work with ?inline in production build #6984

Closed
7 tasks done
Marcisbee opened this issue Feb 18, 2022 · 0 comments · Fixed by #7591
Closed
7 tasks done

Css modules don't work with ?inline in production build #6984

Marcisbee opened this issue Feb 18, 2022 · 0 comments · Fixed by #7591

Comments

@Marcisbee
Copy link

Describe the bug

I have a need to share css between iframe and parent. And the way I figure I would do this is use css modules + ?inline to get the parsed contents into <style> element in iframe.

This works only in dev mode, whenever I build it ?inline returns empty string.

npm run dev

Works as expected (color get shared):
image


npm run build && npm run preview

Doesn't work as expected (iframe gets no style):
image

Reproduction

https://stackblitz.com/edit/vitejs-vite-qgqdy8?file=main.js&terminal=dev

System Info

System:
    OS: macOS 12.0.1
    CPU: (8) arm64 Apple M1
    Memory: 78.77 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - /var/folders/pd/qdphcr2548v8rbws7vjfjw180000gn/T/fnm_multishells/78075_1645101839115/bin/node
    Yarn: 1.22.17 - ~/.yarn/bin/yarn
    npm: 8.1.0 - /var/folders/pd/qdphcr2548v8rbws7vjfjw180000gn/T/fnm_multishells/78075_1645101839115/bin/npm
  Browsers:
    Brave Browser: 94.1.30.87
    Chrome: 98.0.4758.102
    Firefox: 97.0
    Safari: 15.1
  npmPackages:
    vite: ^2.8.0 => 2.8.2

Used Package Manager

npm

Logs

No response

Validations

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants