I have a vite react TS app with JSX components, mudule.scss and global css files. When I build it using Library Mode I get separated .js, .d.ts and .css. But when I install it in any other app, the styling do not get applied.
The package works as expected, but the styling does not work at all.
Fixed using: vite-plugin-css-injected-by-js
//...
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
//...
export default defineConfig({
//...
plugins: [
react(),
//...
cssInjectedByJsPlugin(), // HERE
],
//...
})