It just so happens that @sanderdrummer created a branch to do exactly this (as a temporary work-around) just one hour after you created this issue ❤️ . What's even better he also published it to npm as plugin-react-swc-emotion.
Simply switch from @vitejs/plugin-react-swc to plugin-react-swc-emotion in your package.json, and then change the import statement in vite.config.ts to point to plugin-react-swc-emotion, like so:
import { defineConfig } from 'vite'
// TODO: revert to official `@vitejs/plugin-react-swc` once support for configuring `importSource` is added
import react from 'plugin-react-swc-emotion' // @ts-ignore
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
It just so happens that @sanderdrummer created a branch to do exactly this (as a temporary work-around) just one hour after you created this issue ❤️ . What's even better he also published it to npm as plugin-react-swc-emotion.
Simply switch from
@vitejs/plugin-react-swc
toplugin-react-swc-emotion
in yourpackage.json
, and then change the import statement invite.config.ts
to point toplugin-react-swc-emotion
, like so: