Issue with Colorjs.io that seems to lead back to Vanilla Extract
See original GitHub issueDescribe the bug
I have an issue where the Colorjs.io library toString()
method outputs a wrong color format when used inside *.css.ts
files.
I filed this issue originally here and there’s some further information, but given the method seems to otherwise work well in pure node, it may be related to how VE builds the *.css.ts
files. Any ideas what could be happening?
Reproduction
https://github.com/mystrdat/colorjs-vanilla-test
System Info
System:
OS: Linux 6.0 Fedora Linux 37.20221101.n.0 (Silverblue)
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Memory: 24.92 GB / 31.28 GB
Container: Yes
Shell: 3.5.0 - /usr/bin/fish
Binaries:
Node: 16.17.1 - ~/.local/share/nvm/v16.17.1/bin/node
npm: 8.15.0 - ~/.local/share/nvm/v16.17.1/bin/npm
npmPackages:
@vanilla-extract/css: ^1.9.1 => 1.9.1
@vanilla-extract/vite-plugin: ^3.6.1 => 3.6.1
vite: ^3.2.0 => 3.2.2
Used Package Manager
npm
Logs
No response
Validations
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
Issues · vanilla-extract-css/vanilla-extract - GitHub
Contribute to vanilla-extract-css/vanilla-extract development by creating an ... Issue with Colorjs.io that seems to lead back to Vanilla Extract pending ...
Read more >Color.js: Let's get serious about color
Let's get serious about color · Fully color space aware · Doesn't gloss over color science · Up to date with CSS Color...
Read more >What's the Best Vanilla Extract? The Vanilla Queen Tells All
The best quality vanilla extracts come with a price. The simple answer for what is the best vanilla extract often boils down to...
Read more >Tutorial 6: Transformers and Multi-Head Attention
For each element, we perform an attention layer where based on its query, we check the similarity of the all sequence elements' keys,...
Read more >I want candy! Introduction to Vanilla Extract library | TSH.io
The Vanilla Extract library is not like any other CSS-in-JS solution. ... The battle of frontend world domination between frameworks seems ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just debugged a bit in both the browser and node (with no knowledge of how VE works internally). The difference between browser and node is in
ColorSpace.getFormat
when callingprocessFormat()
(ref):In node with VE the compiled code looks like this:
In the browser the
processFormat()
is called as expected. In node there is a strange behavior. The third argument__create
is the function that gets called (returned by__privateMethod
). Now the funny thing is that__create
is declared and initialized twice in the same file, once for theprocessFormat
function and once for thegetPath
function - and we end up in the latter one instead ofprocessFormat
(which then returns something different which than later breaks everything). The file looks like this:Assuming that the file was transformed by esbuild (as Vite uses esbuild, but I don’t know if there is any other magic going on): this was actually a bug in esbuild that was fixed over one year ago https://github.com/evanw/esbuild/issues/1424
That’s all I’ve found out so far. It’s time to call it a day 😴
That makes sense given the bug only manifests in
*.css.ts
files and not otherwise in the Vite stack. @markdalgleish would it be possible to updateesbuild
in the integration package to squash this? Many thanks again for debugging this @rothsandro ❤️