feat(next/image)!: remove `squoosh` in favor of `sharp` as optional dependency (#63321)
## History Previously, we added support for `squoosh` because it was a wasm implementation that "just worked" on all platforms when running `next dev` for the first time. However, it was slow so we always recommended manually installing `sharp` for production use cases running `next build` and `next start`. Now that [`sharp` supports webassembly](https://sharp.pixelplumbing.com/install#webassembly), we no longer need to maintain `squoosh`, so it can be removed. We also don't need to make the user install sharp manually because it can be installed under `optionalDependencies`. I left it optional in case there was some platform that still needed to manually install the wasm variant with `npm install --cpu=wasm32 sharp` such as codesandbox/stackblitz (I don't believe sharp has any fallback built in yet). Since we can guarantee `sharp`, we can also remove `get-orientation` dep and upgrade `image-size` dep. I also moved an [existing `sharp` test](https://github.com/vercel/next.js/pull/56674) into its own fixture since it was unrelated to image optimization. ## Related Issues - Fixes https://github.com/vercel/next.js/issues/41417 - Related https://github.com/vercel/next.js/pull/54670 - Related https://github.com/vercel/next.js/issues/54708 - Related https://github.com/vercel/next.js/issues/44804 - Related https://github.com/vercel/next.js/issues/48820 - Related https://github.com/vercel/next.js/pull/61810 - Related https://github.com/vercel/next.js/pull/61696 - Related https://github.com/vercel/next.js/issues/44685 - Closes https://github.com/vercel/next.js/issues/64362 ## Breaking Change This is a breaking change because newer versions of `sharp` no longer support `yarn@1`. - https://github.com/lovell/sharp/issues/3750 The workaround is to install with `yarn --ignore-engines` flag. Also note that Vercel no longer defaults to yarn when no lockfile is found - https://github.com/vercel/vercel/pull/11131 - https://github.com/vercel/vercel/pull/11242 Closes NEXT-2823
Showing
| ... | @@ -110,7 +110,6 @@ | ... | @@ -110,7 +110,6 @@ |
| "@types/react-dom": "18.2.23", | "@types/react-dom": "18.2.23", | ||
| "@types/relay-runtime": "14.1.13", | "@types/relay-runtime": "14.1.13", | ||
| "@types/selenium-webdriver": "4.0.15", | "@types/selenium-webdriver": "4.0.15", | ||
| "@types/sharp": "0.29.3", | |||
| "@types/string-hash": "1.1.1", | "@types/string-hash": "1.1.1", | ||
| "@types/trusted-types": "2.0.3", | "@types/trusted-types": "2.0.3", | ||
| "@typescript-eslint/eslint-plugin": "6.14.0", | "@typescript-eslint/eslint-plugin": "6.14.0", | ||
| ... | @@ -160,7 +159,7 @@ | ... | @@ -160,7 +159,7 @@ |
| "html-validator": "5.1.18", | "html-validator": "5.1.18", | ||
| "http-proxy": "1.18.1", | "http-proxy": "1.18.1", | ||
| "husky": "8.0.0", | "husky": "8.0.0", | ||
| "image-size": "0.9.3", | "image-size": "1.1.1", | ||
| "is-animated": "2.0.2", | "is-animated": "2.0.2", | ||
| "isomorphic-unfetch": "3.0.0", | "isomorphic-unfetch": "3.0.0", | ||
| "jest": "29.7.0", | "jest": "29.7.0", | ||
| ... | ... |
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File deleted
This diff is collapsed.
File deleted
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File deleted
This diff is collapsed.
File deleted
This diff is collapsed.
File deleted
This diff is collapsed.
File deleted
This diff is collapsed.
File deleted
File deleted
This diff is collapsed.
This diff is collapsed.
File deleted
This diff is collapsed.
File deleted
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Please
register
or
sign in
to comment