File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,10 +15,20 @@ declare module 'dynamic-import-polyfill' {
1515}
1616
1717// SVG handling
18+ // declare module '*.svg' {
19+ // const content: any;
20+ // // eslint-disable-next-line import/no-default-export -- This is how we import SVGs
21+ // export default content;
22+ // }
1823declare module '*.svg' {
19- const content : any ;
20- // eslint-disable-next-line import/no-default-export -- This is how we import SVGs
21- export default content ;
24+ import type React from 'react' ;
25+
26+ const ReactComponent : React . FunctionComponent <
27+ React . SVGProps < SVGSVGElement > & { title ?: string }
28+ > ;
29+
30+ // eslint-disable-next-line import/no-default-export -- vite poc
31+ export default ReactComponent ;
2232}
2333
2434// Extend PerformanceEntry from lib.dom.ts with current 'In Draft' properties (to allow access as use in browsers that support)
Original file line number Diff line number Diff line change 1+ import react from '@vitejs/plugin-react-swc' ;
12import express , { type Handler , Router } from 'express' ;
23import { createServer } from 'vite' ;
34import svgr from 'vite-plugin-svgr' ;
@@ -136,7 +137,23 @@ export const devServer = async (): Promise<void> => {
136137 const vite = await createServer ( {
137138 server : { middlewareMode : true } ,
138139 appType : 'custom' ,
139- plugins : [ svgr ( ) ] ,
140+ plugins : [
141+ react ( {
142+ jsxImportSource : '@emotion/react' ,
143+ parserConfig : { tsx : true } ,
144+ } ) ,
145+ svgr ( {
146+ // svgr options: https://react-svgr.com/docs/options/
147+ svgrOptions : {
148+ exportType : 'default' ,
149+ ref : true ,
150+ svgo : false ,
151+ titleProp : true ,
152+ } ,
153+ include : '**/*.svg' ,
154+ } ) ,
155+ ] ,
156+ // plugins: [svgr()],
140157 } ) ;
141158 console . log ( '!!! Vite httpServer:' , vite . httpServer ) ;
142159
Original file line number Diff line number Diff line change @@ -40,7 +40,16 @@ export default defineConfig({
4040 jsxImportSource : '@emotion/react' ,
4141 parserConfig : { tsx : true } ,
4242 } ) ,
43- svgr ( ) ,
43+ svgr ( {
44+ // svgr options: https://react-svgr.com/docs/options/
45+ svgrOptions : {
46+ exportType : 'default' ,
47+ ref : true ,
48+ svgo : false ,
49+ titleProp : true ,
50+ } ,
51+ include : '**/*.svg' ,
52+ } ) ,
4453 ] ,
4554 resolve : {
4655 alias : {
You can’t perform that action at this time.
0 commit comments