DEV Community

Discussion on: Using emotionJs with Vite

elpddev profile image
Eyal Lapid

I got emotion to work only by specifying the babel plugin on vite react plugin config as per this article

Without it, the css was not working and was seend as [[Object, Object]] in the dom.

export default defineConfig({
  plugins: [
      jsxImportSource: "@emotion/react",
      babel: {
        plugins: ["@emotion/babel-plugin"],
Enter fullscreen mode Exit fullscreen mode