progital / gatsby-wpgraphql-inline-images

Solution for Gatsby and WPGraphQL sourced content. Downloads images locally.
MIT License
35 stars 12 forks source link

Not honouring pathPrefix or assetPrefix config options #25

Closed charlesmulder closed 4 years ago

charlesmulder commented 4 years ago

Inline images are displaying correctly in development environment, but inline images are missing when building and deploying to a sub-folder.

Gatsby allows this by setting the pathPrefix configuration option in gatsby-config.js.

My guess is the plugin isn't using the withPrefix function, which is explained in the following article Adding a Path Prefix.

I'm still investigating, where the /static path is being set...might not be in this plugin. Any advice is appreciated.

charlesmulder commented 4 years ago

Ah ha. gatsby-wpgraphql-inline-images has it's own undocumented pathPrefix configuration option.

{
  resolve: 'gatsby-wpgraphql-inline-images',
  options: {
    pathPrefix: process.env.NODE_ENV === 'production' ? '/my-prefix' : '',
  },
},
progital commented 4 years ago

It's not documented because I haven't tested it. Never needed that. It would be very helpful if you could test and comment whether it works as expected.

charlesmulder commented 4 years ago

Yes, it seems to work as expected. If I find anything strange, I will report it here.

Thanks for the plugin!