Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support strict dependency install for image integration #5034

Merged
merged 1 commit into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/small-laws-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/image': patch
---

Support strict dependency install
2 changes: 1 addition & 1 deletion packages/integrations/image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@altano/tiny-async-pool": "^1.0.2",
"http-cache-semantics": "^4.1.0",
"image-size": "^1.0.2",
"kleur": "^4.1.5",
"magic-string": "^0.25.9",
"mime": "^3.0.0",
"slash": "^4.0.0"
Expand All @@ -57,7 +58,6 @@
"astro-scripts": "workspace:*",
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"kleur": "^4.1.4",
"mocha": "^9.2.2",
"rollup-plugin-copy": "^3.4.0",
"sharp": "^0.31.0",
Expand Down
5 changes: 2 additions & 3 deletions packages/integrations/image/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,15 @@ export default function integration(options: IntegrationOptions = {}): AstroInte
function getViteConfiguration() {
return {
plugins: [createPlugin(_config, resolvedOptions)],
optimizeDeps: {
include: ['image-size'].filter(Boolean),
},
Comment on lines -52 to -54
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like image-size is being accessed in the client through some testing, and Vite/Astro was reporting that it can't resolve image-size with pnpm, so I removed this.

build: {
rollupOptions: {
external: ['sharp'],
},
},
ssr: {
noExternal: ['@astrojs/image', resolvedOptions.serviceEntryPoint],
// CJS dependencies used by `serviceEntryPoint`
external: ['http-cache-semantics', 'image-size', 'mime'],
},
assetsInclude: ['**/*.wasm'],
};
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

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