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

[v2] url-loader for miscAssets? (webpack-utils.js) #6963

Closed
zauni opened this issue Aug 2, 2018 · 4 comments · Fixed by #7061
Closed

[v2] url-loader for miscAssets? (webpack-utils.js) #6963

zauni opened this issue Aug 2, 2018 · 4 comments · Fixed by #7061
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@zauni
Copy link
Contributor

zauni commented Aug 2, 2018

Summary

A small PDF file gets a base64 encoded URL, whereas in gatsby v1 it got a normal hashed URL.

Relevant information

In webpack-utils.js you define the url-loader for the loaders.file object and use it for audio, video and pdf files here

Is this wrong and it should be the normal file-loader (which is not producing base64 encoded urls) or is this the expected behavior and I should change my webpack config in the gatsby-node.js file to get the v1 behavior?

In my code is something like this:

import downloadPdf from '../../assets/downloads/file.pdf';

<a href={downloadPdf} target="_blank">Download</a>

In gatsby v1 the URL is like this: /static/file.a01dde10.pdf.
In gatsby v2 the URL is like this: data:application/pdf;base64,JVBERi0xLjYNJeLjz9...lRU9GDQo=

Thanks for any help or explanation!

@piotrkwiecinski piotrkwiecinski added the type: question or discussion Issue discussing or asking a question about Gatsby label Aug 2, 2018
@colbyfayock
Copy link
Contributor

colbyfayock commented Aug 5, 2018

having the same issue, though i was thinking it was going to be fixed in #6661 from issue #5998. wasn't sure if it hadnt made it to the most recent build or maybe just addressed another issue. the issue renders the link unusable

@KyleAMathews
Copy link
Contributor

Yeah — PDFs shouldn't ever be inlined.

@KyleAMathews
Copy link
Contributor

Anyone want to update the webpack config for this?

@zauni
Copy link
Contributor Author

zauni commented Aug 6, 2018

Thanks for your feedback! I will try to make a pull request.

zauni pushed a commit to zauni/gatsby that referenced this issue Aug 6, 2018
KyleAMathews pushed a commit that referenced this issue Aug 7, 2018
* Assets use file-loader instead of url-loader

Fixes #6963

* Just pdf files use file-loader
porfirioribeiro pushed a commit to porfirioribeiro/gatsby that referenced this issue Aug 22, 2018
* Assets use file-loader instead of url-loader

Fixes gatsbyjs#6963

* Just pdf files use file-loader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants