Skip to content

Instantly share code, notes, and snippets.

@unyo
Last active January 25, 2024 05:57
Show Gist options
  • Save unyo/f73ab5f9344b3948260b8d5e40ffbd42 to your computer and use it in GitHub Desktop.
Save unyo/f73ab5f9344b3948260b8d5e40ffbd42 to your computer and use it in GitHub Desktop.
Vite + SWC + styled-components displayName
#!/usr/bin/zsh
npm create vite@latest # choose template react, js + swc
npm i --save-dev @vitejs/plugin-legacy terser @vitejs/plugin-react-swc @swc/[email protected] # downgrade @swc/plugin-styled-components to 1.5.111 https://github.com/vitejs/vite-plugin-react-swc/issues/190#issuecomment-1907977402
npm i --save styled-components
# edit vite.config.js:
cat <<EOF > vite.config.js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import legacy from '@vitejs/plugin-legacy'
export default defineConfig({
plugins: [
react({ plugins: [["@swc/plugin-styled-components", {}]] }),
legacy(),
],
})
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment