Closed felocru closed 4 years ago
Hi @felocru
Thanks for reporting and sorry to hear that the latest version isn’t working for you.
To be honest, I have tested it only with the „official“ way via defining the plugin in the gridsome.config.js
.
I assume it isn’t working with your implementation, because we changed the logic in the background. We had some trouble with remote sources (e.g. Contenful) .
The plugin will now called after the loadSource
process is done and we have all collections in the GraphQL instance.
—
Question: what is the reason that you have to load the plugin in the gridsome.server.js
.
Regards, Marcus
You can find all changes here:
https://github.com/noxify/gridsome-plugin-remote-image/compare/v1.0.0...v1.1.0
gridsome.server.js
When I use your plugin in gridsome.config.js
it works in parallel withgridsome.server.js
however this is not desirable for me since image urls I get from a CMS through an API, along with the other information. So it was impossible for me to keep it separate, by using your plugin inside gridsome I make sure to fill the collections before processing the images. Thanks for your reply.
Hi @felocru
just to make sure I understood your last reply correctly - Does it work now for you after using the gridsome.config.js
instead the gridsome.server.js
to load the plugin?
Regards, Marcus
Hi! I'm having the same issue, i'm using it in gridsome.server.js, and it broke for me also. Am looking in to fixing it, but short on time, so will roll back for now.
it seems that github converts their own links not as expected.
https://github.com/noxify/gridsome-plugin-remote-image/compare/v1.0.0...v1.1.0
gridsome.server.js
@pmcp - In our previous version we used loadSource
to get the image fields - i assume you have used the same workaround as @felocru .
Since we have updated the logic and running the plugin after the loadSource
is done, you should be able to use the plugin without any workarounds.
Cool, thanks for the reply!
I've been trying to implement it, I fails with images uploaded with netlify cms, images with remote urls work nicely, but the once with a local path fail. It might be a problem with my setup, not sure yet.
To be clear: i've got a mixed bag of remote and local images, so the plugin should run if it's a remote image, and not if the image is local, i guess, but at this point it seems to fail if the image is local when using normalizeUrl.
Hi @felocru
just to make sure I understood your last reply correctly - Does it work now for you after using the
gridsome.config.js
instead thegridsome.server.js
to load the plugin?Regards, Marcus
No, what I meant is that the previous version works well for me. Therefore, I had to go back to the previous version. I haven't had a chance to try the new version but from the gridsome.config.js
. It may work now. I'm going to do my tests.
No, what I meant is that the previous version works well for me. Therefore, I had to go back to the previous version. I haven't had a chance to try the new version but from the
gridsome.config.js
. It may work now. I'm going to do my tests.
@felocru , how did you go back to previous version? I'm trying to run 1.0.0 now, but get the error "import got from "got"; syntaxError: Unexpected identifier (coming from node_modules/image-download/index.js:1 )
Which means, at this point, i'm pretty much stuck.
I didn't have that problem you present.
I just did:
npm uninstall @noxify/gridsome-plugin-remote-image
Then I made:
npm install @noxify/gridsome-plugin-remote-image@1.0.0
If that doesn't work for you, maybe you need to reinstall image-download.
Cool, thanks for the reply!
I've been trying to implement it, I fails with images uploaded with netlify cms, images with remote urls work nicely, but the once with a local path fail. It might be a problem with my setup, not sure yet.
Do you really need to use it with local images from Netlify CMS? Aren't those images stored in the same folder as your Gridsome project, so don't really need downloading?
i have to admit, my use case is an outlier: sometimes it is a local file, sometimes it is a remote file. so i guess the plugin should just return the local path. but i would understand if that is not in scope of the plugin.
@pmcp Well, assuming that your local images will be a path like /static/assets/image
, it shouldn't be too hard to update this plugin so it just returns that local path as a relative path if it detects it isn't a URL.
@pmcp / @felocru - I have added a simple local file check inside the download method.
If the path is a local file, we stop the processing and returning the given path ( from the local image )
I hope this solves your problem and you're able to use the latest version without any hacks ;)
A feeback if it works or not would be good :)
Regards, marcus
Hello again. An apology for the delay. I have already updated to the latest version and I can confirm that it works perfectly fine. Even svg format images work fine for me (I had problems with them).
As a suggestion it would be good if they allowed an array of typeName
, since I handle 10 collections with the same images fields. Then it feels redundant to repeat options
several times. Thanks for the plugin.
Hi, I have been using this plugin a little differently. Since I need the plugin to be dependent on my code which is in gridsome.server.js so after loading a collection I manually use this code:
However, in all my queries, I have image = null. If I go back to the previous version it works for me wonderfully. Do you have any idea what might be going on? Thank you.