svg as ReactComponent support

This commit is contained in:
Kakabay 2023-01-21 14:59:43 +05:00
parent 290a6a5c5a
commit 99b233910d
5 changed files with 415 additions and 103 deletions

6
custom.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
declare module '*.svg' {
import React = require('react');
export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
const src: string;
export default src;
}

498
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,8 @@
"react-router-dom": "^6.7.0",
"react-spinners": "^0.13.8",
"sass": "^1.57.1",
"uuid": "^9.0.0"
"uuid": "^9.0.0",
"vite-plugin-svgr": "^2.4.0"
},
"devDependencies": {
"@types/react": "^18.0.26",

View File

@ -16,6 +16,6 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"],
"include": ["src", "custom.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View File

@ -1,7 +1,8 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
plugins: [svgr(), react()],
});