Skip to content

Commit

Permalink
fix: make sharp an optional dep (#8416)
Browse files Browse the repository at this point in the history
* fix: make sharp an optional dep

* chore: lockfile

* chore: changeset

---------

Co-authored-by: Nate Moore <[email protected]>
  • Loading branch information
Princesseuh and natemoo-re authored Sep 6, 2023
1 parent 35dff82 commit 48ff785
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-icons-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Installing will no longer fail when Sharp can't be installed
4 changes: 3 additions & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@
"resolve": "^1.22.4",
"semver": "^7.5.4",
"server-destroy": "^1.0.1",
"sharp": "^0.32.5",
"shiki": "^0.14.3",
"string-width": "^6.1.0",
"strip-ansi": "^7.1.0",
Expand All @@ -176,6 +175,9 @@
"yargs-parser": "^21.1.1",
"zod": "3.21.1"
},
"optionalDependencies": {
"sharp": "^0.32.5"
},
"devDependencies": {
"@astrojs/check": "^0.1.0",
"@playwright/test": "^1.37.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,9 @@ export const InvalidDynamicRoute = {
export const MissingSharp = {
name: 'MissingSharp',
title: 'Could not find Sharp.',
message: 'Could not find Sharp. Please install Sharp (`sharp`) manually into your project.',
hint: "See Sharp's installation instructions for more information: https://sharp.pixelplumbing.com/install. If you are not relying on `astro:assets` to optimize, transform, or process any images, you can configure a passthrough image service instead of installing Sharp. See https://docs.astro.build/en/reference/errors/missing-sharp for more information.",
message:
'Could not find Sharp. Please install Sharp (`sharp`) manually into your project or migrate to another image service.',
hint: "See Sharp's installation instructions for more information: https://sharp.pixelplumbing.com/install. If you are not relying on `astro:assets` to optimize, transform, or process any images, you can configure a passthrough image service instead of installing Sharp. See https://docs.astro.build/en/reference/errors/missing-sharp for more information.\n\nSee https://docs.astro.build/en/guides/images/#default-image-service for more information on how to migrate to another image service.",
};
// No headings here, that way Vite errors are merged with Astro ones in the docs, which makes more sense to users.
// Vite Errors - 4xxx
Expand Down
52 changes: 49 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 48ff785

Please sign in to comment.