-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
SVG Files are not included in the dev bundle. #2065
Comments
@chrisjpatty how the |
A demo would help greatly. |
@alisonmonteiro Here is a sample of the SVG code. I've omitted the majority of the paths for the sake of brevity.
|
@chrisjpatty just copied your svg and saved as a file and: import Logo from '../logo.svg';
// ...
render() {
return (
<header>
<img src={Logo} />
</header>
)
} no errors at all. 👍 |
@gaearon @alisonmonteiro Alright, I've got a demo you can look at. You'll notice the header image is a broken link, and if you look at the actual file, it's been stripped down to a single line of code:
Hopefully this is what you need to troubleshoot this issue. Let me know what else I can provide and thank you for the help! **Edit: ** Whoops, forgot to include the link: Broken SVG Demo |
Sorry, where can we find the demo? |
Is it possible to also share the source? |
I don't know that my employer would love if I shared the whole source, but I could probably share some of the files. Which files do you think would be most useful? |
The file that imports the SVG, the SVG file, and their exact locations in the source tree. |
Sure, I can do that. Here's an abbreviated sample of the structure:
And a zip folder containing |
Is everything inside |
Do you mean that you ejected? On which version of |
Yeah, everything is inside of |
I'm not sure how to check the version, but I used the tool on 4/17/2017 and ejected that very same day. |
You can find the commit in which you ejected, and it will contain removal of |
I actually ejected immediately unfortunately, so it doesn't show up in my initial commit. |
But if it's helpful, here is my full package.json at this point:
|
It would really help if you could try reproducing this in a freshly created app, or trim down your app to the minimal amount files necessary to reproduce (and then share the runnable project). |
I'll see what I can do. Thanks for your help so far! |
Got it! Here's a trimmed down version of the source that you can compile. |
Tagging as a bug and needing help. Would appreciate somebody looking into it! |
@chrisjpatty did you add:
to your |
I don't believe so, I only added the scss loader. I'm away from my computer, but I'll check through my commits to make sure I didn't paste over it on accident somewhere. |
I believe it's worth noting that you do not need to eject to use Sass, you can read how to do that in our docs. |
@existentialism No, I've checked my commits and I never added that piece. But it turns out that it's the piece that was breaking it. Removing that line seems to have fixed it. |
Can you reproduce the problem with latest npm?
Yes
Description
SVG files fail to be included in the development bundle.
This occurs when the image is imported like so:
import Logo from '../../common/img/logo.svg';
and used like so:
<img src={Logo} />
Other image files (.png, .jpg, etc) render as expected, but SVG files never come through.
Expected behavior
SVG images should load as normal.
Actual behavior
Renders as a broken
<img />
tag. When the URL to the image, as output by Webpack, is entered into the URL bar, it renders this error: "error on line 1 at column 1: Document is empty".Environment
Node version 7.9.0
NPM version 4.2.0
Windows 10 | Version 1703 | OS Build 15063.0
Google Chrome | 58.0.3029.81 (64-bit)
Reproducible Demo
Due to some time constraints, I can't make a demo at the moment. If you can't reproduce this issue let me know and I'll try to get a demo up.
The text was updated successfully, but these errors were encountered: