Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React + vite don't recognize and not load file css

Tags:

reactjs

vite

I have a problem with my react-vite project. Vite doesn't recognize my style.css file

This is my configuration file.

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
})

Somebody can help me?

like image 763
IlCorsaroNero Avatar asked Oct 24 '25 05:10

IlCorsaroNero


1 Answers

In the final I solved with this configuration of vite :

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  css:{
    modules:{
      localsConvention:"camelCase",
      generateScopedName:"[local]_[hash:base64:2]"
    }

  }

})

like image 151
IlCorsaroNero Avatar answered Oct 26 '25 18:10

IlCorsaroNero