JonasKruckenberg / imagetools

Load and transform images using a toolbox :toolbox: of custom import directives!
MIT License
925 stars 59 forks source link

fix: attempt to make sharp dependency declaration compatible with yarn #730

Closed benmccann closed 3 months ago

benmccann commented 3 months ago

closes https://github.com/JonasKruckenberg/imagetools/issues/659

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: ccb28bf5d0bea42716928b31989cf1762a581892

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | --------------- | ----- | | imagetools-core | Patch | | vite-imagetools | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.69%. Comparing base (31c14f2) to head (ccb28bf).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #730 +/- ## ======================================= Coverage 95.69% 95.69% ======================================= Files 33 33 Lines 1278 1278 Branches 224 224 ======================================= Hits 1223 1223 Misses 55 55 ``` | [Flag](https://app.codecov.io/gh/JonasKruckenberg/imagetools/pull/730/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Kruckenberg) | Coverage Δ | | |---|---|---| | [imagetools-core](https://app.codecov.io/gh/JonasKruckenberg/imagetools/pull/730/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Kruckenberg) | `95.69% <ø> (ø)` | | | [vite-imagetools](https://app.codecov.io/gh/JonasKruckenberg/imagetools/pull/730/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Kruckenberg) | `95.69% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Kruckenberg#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

TimJohns commented 3 months ago

@benmccann I can't attest to the original issue #659 as reported, but I can report that this resolves a similar issue I was seeing using npm with vite-imagetools 7.0.2 in my package.json devDependencies, that appears to have been due to sharp being included in devDependencies vs. dependencies (fixed at 57e070e)

Before (vite-imagetools 7.0.2):

> vue-tsc --noEmit && vite build --mode development

failed to load config from /Users/tjohns/Src/epic-roadtrip-planner-webapp/vite.config.ts
error during build:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'sharp' imported from /Users/tjohns/Src/epic-roadtrip-planner-webapp/node_modules/vite-imagetools/dist/index.js
    at packageResolve (node:internal/modules/esm/resolve:853:9)
    at moduleResolve (node:internal/modules/esm/resolve:910:20)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36)

After (vite-imagetools 7.0.4):

> vue-tsc --noEmit && vite build --mode development

...

✓ built in 8.42s

Thanks for the fix, and I appreciate imagetools and the work you folks are doing here.