Why CSS from externals packages is appended to my CSS bundle? #1414
Unanswered
raphaelboukara
asked this question in
Q&A
Replies: 1 comment 3 replies
-
We've documented We haven't done this for the webpack plugin though, and it's not exactly the same as the I'm a bit confused as to what you expect the outcome to be. Are you using CSS variables from a separate package, but don't want them to be included in the CSS bundle? Or do you not expect CSS variables defined with Vanilla Extract to be included in the CSS bundle? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
The vanilla extract plugin includes an externals option.
Where can we find documentation about this feature? I'm trying to understand its exact functionality.
Specifically, when I define a package as "external", I expect the CSS variables from this package not to be included in my CSS bundle. However, this doesn't seem to be the case.
From my understanding, defining a package as "external" should signal to Webpack to exclude all exposed content from this package in the bundle.
However, it appears that the
externals
option only affects JavaScript files and does not consider CSS. Could you provide some clarification on this behavior and how we can achieve the desired outcome for CSS?I played with it locally and I get it work by enriching the filter in the
appendCss
function of the css adapter:vanilla-extract/packages/integration/src/processVanillaFile.ts
Lines 82 to 91 in e7d79f2
Something like:
Maybe we can change the
outputCss
option to possibly be a function that receives the actual fileScope and return a boolean? If it's ok for you, can I send a PR? It will help me a lot to decrease CSS bundle size.Something like:
My use case is that I have a page with multiple CSS bundle. Each CSS bundle uses CSS from some "external" package.
Beta Was this translation helpful? Give feedback.
All reactions