#vanilla-extract causes error "No CSS for file" in Nuxt module

2 messages · Page 1 of 1 (latest)

storm scaffoldBOT
#

Hi @unborn bluff. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

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())
  },
})

[addVitePlugin docs]

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:

  1. 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.
  2. 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.

Since you've shared your repository, those communities will be better positioned to diagnose the exact cause.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: