Niels-IO / next-image-export-optimizer

Use Next.js advanced <Image/> component with the static export functionality. Optimizes all static images in an additional step after the Next.js static export.
MIT License
460 stars 56 forks source link

Added ability to load remote images from promise #113

Closed PeterKottas closed 1 year ago

PeterKottas commented 1 year ago

I was unable to run the tests though. Do you actually build this in CI somewhere? What is the reusable way to develop? I tried just yarn install and test but it kept complaining.

I think there might be some dev dependencies missing. If you let me know how you do this, I can add it to the readme.

TLDR of the work here: I just refactored some of the functionality into an async function called getRemoteImageURLs which returns both remoteImageURLs and remoteImageFilenames in a similar fashion it used to before. This function is then used inside the main plugin function.

Niels-IO commented 1 year ago

Hi @PeterKottas

There is a GitHub action that runs the test on every PR and push to the master branch. You can run the tests manually in your local environment with npm run prepublishOnly.

The GitHub Action did not execute as you are a first time collaborator but now it should run automatically for you.

The test fails currently. I think the remote file name array gets not resolved to an array correctly at the moment.

PeterKottas commented 1 year ago

I still cannot execute tests. I get this kind of errors:

./pages/typescript.tsx:4:27
    Type error: Cannot find module 'next-image-export-optimizer' or its corresponding type declarations.

      2 | import ExportedImage_Local from "../../src/ExportedImage";
      3 | import ExportedImageLegacy_Local from "../../src/legacy/ExportedImage";
    > 4 | import ExportedImage from "next-image-export-optimizer";
        |                           ^
      5 | import ExportedImageLegacy from "next-image-export-optimizer/legacy/ExportedImage";

I simply ran

npm run prepublishOnly

Strange, are you on windows? I wonder if this is a cross-platform issue.

PeterKottas commented 1 year ago

Ping. This is now tested, we use it in production via a direct repo link. Let me know if there's anything else we should fix before it goes live.

Niels-IO commented 1 year ago

You were able to resolve the testing issue? I am on a M1 Mac.

I also published your PR in version 1.4.0. Thanks for your contribution!

PeterKottas commented 1 year ago

Cheers man. Nope, did not manage to get to the bottom of that. But the truth be told, I didn't really spend much time on it. I can make it a part of #114