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

Module parse error with pdf #775

Closed
phil-kt opened this issue Sep 27, 2016 · 3 comments
Closed

Module parse error with pdf #775

phil-kt opened this issue Sep 27, 2016 · 3 comments

Comments

@phil-kt
Copy link

phil-kt commented Sep 27, 2016

I'm trying to add a pdf to my app, and I'm getting a Module parse failed error. The pdf is in the src folder, shouldn't file-loader handle the pdf extention or am I misunderstanding it?

import pdf as './files/blah.pdf'

<a href={pdf}>link</a>
@phil-kt phil-kt changed the title Module pare error with pdf Module parse error with pdf Sep 27, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 27, 2016

Since we maintain a whitelist, we'd have to add it there. I think pdf is a bit of an exotic use case so I would recommend using public folder for it instead.

https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#using-the-public-folder

@gaearon
Copy link
Contributor

gaearon commented Sep 27, 2016

This would get solved with #667 in the future but for now public folder is a fine workaround. Use process.env.PUBLIC_URL + '/blah.pdf' in the code, assuming you put it into public/blah.pdf.

@gaearon gaearon closed this as completed Sep 27, 2016
@phil-kt
Copy link
Author

phil-kt commented Sep 27, 2016

Okay thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants