Libraries shipping vanilla.js
files break the build when app uses a vanilla-extract plugin as well.
#1242
Labels
vanilla.js
files break the build when app uses a vanilla-extract plugin as well.
#1242
Describe the bug
The build error
happens during a build of an app when consuming a library built with the
@vanilla-extract/rollup-plugin
and the app itself using@vanilla-extract/css
and a corresponding plugin e.g.@vanilla-extract/vite-plugin
. The same issue was also observed when building an app using the@vanilla-extract/esbuild-plugin
.The library mentioned in the error can be found here: https://github.com/ffriedl89/rollup-ve-lib.
As far as i managed to figure out - the issue is that the css file filters from the integration package
https://github.com/vanilla-extract-css/vanilla-extract/blob/master/packages/integration/src/filters.ts also match the files in the library that were already processed with the rollup plugin and they get processed again.
The issue is not present when there are no
.vanilla.js
files present in the library or when vite has optimizeDeps enabled.When
optimizedDeps
is enabled vite prebundles a dependency in the.vite/deps
folder which eliminates the.vanilla.js
files before the apps plugin processes the dependency. Therefore no further pass of vanilla-extract happens and everything works as expected.Expected behavior:
A library built with
@vanilla-extract/rollup-plugin
works inside an app that also uses @Vanilla-Extract for it's styling.I'd like to be able to use vanilla-extract end to end :)
Thx!
Let me know if I can help with anything!
Reproduction
https://stackblitz.com/edit/vitejs-vite-215ufr?file=vite.config.ts,package.json,src%2FApp.tsx,index.html&terminal=build
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: