Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import images #136

Open
lepirlouit opened this issue Sep 8, 2020 · 4 comments · May be fixed by #191
Open

How to import images #136

lepirlouit opened this issue Sep 8, 2020 · 4 comments · May be fixed by #191
Labels
help wanted Extra attention is needed

Comments

@lepirlouit
Copy link

How is importing images supposed working ?

import "./assets/react.png"; what is this supposed to do ?

I use the file-loader before
and imported the image path with import MyImagePath from './assets/my_image.png';

doing the same will just assign an empty object to MyImagePath

@jayair
Copy link
Member

jayair commented Oct 9, 2020

Right now we aren't doing anything specific for images. Feel free to open a PR!

@lepirlouit
Copy link
Author

What does it mean in the READMe it's mentionned :

CSS, SASS, and Image Files
Serverless Bundle automatically supports importing css, scss, and image files.

https://github.com/AnomalyInnovations/serverless-bundle#css-sass-and-image-files
What happen when you import an image, like in the example : import "./assets/react.png";

@jayair
Copy link
Member

jayair commented Oct 20, 2020

The docs on this are wrong. Currently for images, the imports are ignored.

https://github.com/AnomalyInnovations/serverless-bundle/blob/master/src/webpack.config.js#L175

You could use the copyFiles option. But I think we should add support for this. PRs are welcome.

@jayair jayair added the help wanted Extra attention is needed label Oct 20, 2020
@azizur
Copy link
Contributor

azizur commented Jan 24, 2021

I have been working on adding support for React v17.0.1 for server-side rendering. It includes support for images. I am finding it challenging to add support for SVG as ReactComponent. I will share a link to my changes shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants