先来看安装完相关依赖包后,
html文档渲染报错:
You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).
解决方案
安装:
npm install -D @emotion/babel-plugin
vite插件配置
plugins: [react({
jsxImportSource: "@emotion/react",
babel: {
plugins: ["@emotion/babel-plugin"],
},
})
]