File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
packages/react-scripts/template Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -638,15 +638,17 @@ declare module "*.gif";
638
638
declare module " *.jpg" ;
639
639
declare module " *.jpeg" ;
640
640
declare module " *.png" ;
641
+ declare module " *.svg" ;
641
642
```
643
+ (you'll have to restart the compiler in order the changes to take place)
642
644
643
645
In this case, we've added several image file extensions as valid module formats.
644
646
645
647
Now that the compiler is configured, here is an example of importing an image file:
646
648
647
649
``` js
648
650
import React from ' react' ;
649
- import logo from ' ./logo.png ' ; // Tell Webpack this JS file uses this image
651
+ import logo from ' ./logo.svg ' ; // Tell Webpack this JS file uses this image
650
652
651
653
console .log (logo); // /logo.84287d09.png
652
654
You can’t perform that action at this time.
0 commit comments