You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,10 +16,10 @@ export default {
16
16
};
17
17
```
18
18
19
-
Then SVG files can be imported as React components, just like [create-react-app](https://create-react-app.dev/docs/adding-images-fonts-and-files#adding-svgs) does:
19
+
Then SVG files can be imported as React components:
20
20
21
21
```js
22
-
import{ ReactComponentasLogo} from"./logo.svg";
22
+
importLogofrom"./logo.svg?react";
23
23
```
24
24
25
25
If you are using TypeScript, there is also a declaration helper for better type inference:
@@ -32,10 +32,6 @@ If you are using TypeScript, there is also a declaration helper for better type
32
32
33
33
```js
34
34
svgr({
35
-
// Set it to `true` to export React component as default.
36
-
// Notice that it will override the default behavior of Vite.
//A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should include. By default all svg files will be included.
50
-
include:"**/*.svg",
45
+
// A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should include. By default all svg files will be included.
46
+
include:"**/*.svg?react",
51
47
52
48
// A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.
0 commit comments