NuxtN
Nuxt10mo ago
14 replies
enti

Nuxt4 and global css import

Context : fresh Nuxt 3.16 install with Nuxt 4 compatibility

When I add a global css import in my nuxt.config.ts file :

export default defineNuxtConfig({
  css: ['~/assets/css/main.css'],
  // yes, file exists from the app/ directory
  // i.e. app/assets/css/main.css from project's root (nuxt4 structure)

  future: {
    compatibilityVersion: 4,
  },

  compatibilityDate: '2025-04-11',
})


I end up with an error 500:

Cannot find module '~/assets/css/main.css' imported from 'virtual:nuxt:C:\Code\project\.nuxt\css.mjs'

Is there a new strategy for global CSS imports with Nuxt4? I didn't find any info about it
Was this page helpful?