vanilla-extract
vanilla-extract copied to clipboard
Add onFileCompiled callback
Per https://github.com/vanilla-extract-css/vanilla-extract/discussions/864
This hook lets users supply the missing piece for integration with non-javascript backends - recording the class-name mapping used by vanilla-extract.
The primary limitation of this callback as it stands is that it's called multiple times per build for the same file (possibly because I have multiple entrypoints importing the same component).
If the classname mapping generation wasn't stable, it wouldn't be clear which one to use unless the current entrypoint was also passed in, which (AFAICT) esbuild doesn't provide to plugins.
Hey @DanielHeath 👋
I assume what you ultimately want to produce is some metafile containing all the Vanilla Extract exports per file? This callback seems like a very low-level way to solve that issue. It's also potentially out of sync as more export processing occurs in the stringifyExports function.
I want to run this by the rest of the team first, but would you be open to a different solution?
Yeah absolutely - this was a more of a quick hack to check I could do it.
Just wanted to check in about the timeline here - if it's likely to be more than a few months I might forge ahead and publish a plugin, but if it's being discussed currently & there's likely to be progress made I'd prefer to wait and see.