Gatsby: [v2] When migrating to v2 webpack fails to load .pdf files

Created on 18 Jun 2018  路  8Comments  路  Source: gatsbyjs/gatsby

In the processing of migrating to v2. Seems like webpack isn't setup to load pdf files anymore.
image

help wanted bug

Most helpful comment

Yeah I went through it and I believe it would indeed be a straightforward fix, I just haven't had the time to go through the whole contributing process. If I find the time this weekend, I'll take care of it.

All 8 comments

Good catch - would you be interested in re-adding support for that?

We would need new rule (or adjust one of existing rules) here - https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/utils/webpack-utils.js to cover .pdf . And if you created new rule (not adjusted existing one) it would have to be added here to https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/utils/webpack.config.js#L284-L290

Looks like this is fixed? I tried running @ylorenzana's repo locally. I don't see this error and able to download the linked PDF. The file is inlined with a data URL though - probably because of this https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/utils/webpack-utils.js#L247. Not sure if this is how it's supposed to work.

@tsriram It's possible, but do keep in mind that I added a custom webpack config in my project to load in PDF files after I migrated my site to V2, so even if support has not been officially added, the pdf download will work.

Ah, okay. It must be the case. Will look into it.

This is still not fixed in v2 - it should be relatively straight forward change - I think adding pdf extension to rules that uses file-loader would fix that.

Yeah I went through it and I believe it would indeed be a straightforward fix, I just haven't had the time to go through the whole contributing process. If I find the time this weekend, I'll take care of it.

Done in #6661, thanks @ylorenzana 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timbrandin picture timbrandin  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

theduke picture theduke  路  3Comments

rossPatton picture rossPatton  路  3Comments