Vite+Vue compile styles into a CSS that never gets loaded #9326
Unanswered
WhyNotHugo
asked this question in
Help/Questions
Replies: 1 comment
-
Answered at #9347 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I mount components into my pages with this
main.ts
:My components are all defined as Vue SFC, and they each have their corresponding
<style>
section.I include
main.${hash}.js
andmain.${hash}.css
via the manifest into my HTML files (this is done with some django glue code; it works and URLs in the source point to the right files which load correctly).In the above case, most of the styles used by components are compiled into
main.${hash}.css
. I have a couple of entry points like this which each mount a different "root" component. Each of them are defined invite.config.js
'sdefineConfig
underbuild.rollupOptions.input
like so:However, for components that I reuse across different entry points, the styles are compiled into separate css files. E.g.:
ExifDetector-a8c268f5.css
includes styles for two components namedRangeSlider
andExifDetector
. The problem is that the generatedjs
code does not in any way load this css files.Additionally, the criteria for splitting css isn't totally predicable. Apparently the two components that I mentioned above are both reused across the same pair of entry-points, so Vite (i think?) decides to put the separate from everything else, but in the same file.
How can I work around this?
Beta Was this translation helpful? Give feedback.
All reactions