Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TINU-93 feat: Vite SVG 세팅을 진행합니다. #42

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"storybook": "^8.4.1",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.1",
"vite": "^5.4.1"
"vite": "^5.4.1",
"vite-plugin-svgr": "^4.3.0"
},
"eslintConfig": {
"extends": [
Expand Down
32 changes: 32 additions & 0 deletions src/assets/icons/ic_rabbit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
5 changes: 5 additions & 0 deletions src/assets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="vite-plugin-svgr/client" />

import IcRabbit from "./icons/ic_rabbit.svg?react";

export { IcRabbit };
8 changes: 7 additions & 1 deletion src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { IcRabbit } from "../assets";

function Home() {
return <></>;
return (
<>
<IcRabbit />
</>
);
}

export default Home;
4 changes: 4 additions & 0 deletions svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module "*.svg" {
const value: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
export default value;
}
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import svgr from 'vite-plugin-svgr'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [react(), svgr()],
})
Loading