abhijithvijayan / web-extension-starter

🖥🔋Web Extension starter to build "Write Once Run on Any Browser" extension
MIT License
2.03k stars 172 forks source link

Not able to import images #40

Closed Akshay090 closed 4 years ago

Akshay090 commented 4 years ago

webpack gives error for importing images in react

abhijithvijayan commented 4 years ago

@Akshay090 You don't have to import image assets, webpack automatically copies source/assets folder to build directory under assets folder.

Copy the image to source/assets folder and use it with

<img src="assets/logo.jpg" />

Feel free to reopen this if the issue still persist.

Akshay090 commented 4 years ago

oh I didn't knew that. I don't think there would be any special benefit to import image as we typically do in normal react app. Your method of doing it is good.

abhijithvijayan commented 4 years ago

create-react-app has loaders to handle the asset imports.

I didnt want to add more loaders to the boilerplate as webextensions usually do not require much of images.