Skip to content

Commit

Permalink
chore: vite-plugin-svgr 플러그인 설치 및 세팅 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAminha committed Apr 29, 2024
1 parent bd3825c commit e7c72ea
Show file tree
Hide file tree
Showing 6 changed files with 1,521 additions and 224 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"styled-reset": "^4.5.2"
},
"devDependencies": {
"@svgr/rollup": "^8.1.0",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/recoil": "^0.0.9",
Expand All @@ -37,6 +38,7 @@
"prettier": "^3.2.5",
"typescript": "^5.2.2",
"vite": "^5.2.0",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.2"
}
}
6 changes: 6 additions & 0 deletions src/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '*.svg' {
import React from 'react';
const src: string;
export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
export default src;
}
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"include": ["src", "svg.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import svgr from '@svgr/rollup';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';

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

0 comments on commit e7c72ea

Please sign in to comment.