DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Discussion on: Using emotionJs with Vite

Collapse
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: [
    react({
      jsxImportSource: "@emotion/react",
      babel: {
        plugins: ["@emotion/babel-plugin"],
      },
    }),
  ],
});
Enter fullscreen mode Exit fullscreen mode