#vanilla-extract causes error "No CSS for file" in Nuxt module
2 messages · Page 1 of 1 (latest)
The knowledge sources provided don't contain specific information about vanilla-extract or the "No CSS for file" error you're encountering. I can't speculate on the root cause or provide a fix that isn't directly supported by the available documentation.
What I can confirm from the knowledge sources is that the approach you're using to register the Vite plugin in your Nuxt module is correct:
import { defineNuxtModule, addVitePlugin } from '@nuxt/kit'
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'
export default defineNuxtModule({
setup(_options, _nuxt) {
addVitePlugin(vanillaExtractPlugin())
},
})
The duplicated absolute path in the error (playground/C:/Users/.../hello-world.css.ts) suggests a path resolution issue — likely something specific to how vanilla-extract's Vite plugin resolves file paths when used inside a Nuxt module's runtime directory. However, the knowledge sources do not contain enough information to diagnose or fix this specific issue.
Recommendations:
- Since this is a vanilla-extract-specific issue, I'd suggest opening an issue on the vanilla-extract GitHub repository or checking their existing issues for similar path duplication problems with Vite.
- You could also check the Nuxt Discord or open an issue on the Nuxt GitHub if you believe it's a Nuxt module resolution problem.