★ 1
npm create vite@latest . -- --template react
★ 2
npm install -D tailwindcss@3 postcss autoprefixer
★ 3 - postcss.config.cjs
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
}
}
★ 4
npm i antd
★ 5
npx tailwind init <--- 3.x에서 필요
★ 6 - index.css
@layer tailwind-base, antd;
@layer tailwind-base {
@tailwind base;
}
@tailwind components;
@tailwind utilities;
★ 7 - tailwind.config.js
export default {
content: ["./src/**/*.{html,js,jsx}"],
theme: {
extend: {},
},
plugins: [],
}
★ 8 - vite.config.js , 절대경로
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { resolve } from 'path';
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
],
resolve: {
alias: [
{ find: "@", replacement: "/src" },
{ find: "@components", replacement: "/src/components" },
{ find: "@headers", replacement: "/src/components/headers" },
{ find: "@pages", replacement: "/src/pages" },
{ find: '@', replacement: resolve(__dirname, 'src') },
{ find: '@pages', replacement: resolve(__dirname, 'src/pages') },
],
},
server: {
port: 3000
},
preview: {
port: 8080
}
})
★ 9 - index.css
@layer tailwind-base, antd;
@layer tailwind-base {
@tailwind base;
}
@tailwind components;
@tailwind utilities;
★ 10 - App.css -삭제
'React' 카테고리의 다른 글
next.js vscode 성능 저하 , 속도 느림 (0) | 2025.03.19 |
---|---|
next error boundary / global error (0) | 2025.02.12 |
next14 - next-auth v5 (0) | 2024.12.09 |
NextAuth 로그인 (0) | 2024.12.03 |
Next auth와 Bearer 토큰 (0) | 2024.11.28 |