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

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Oct 10, 2022

Changes

Fix #4995

  • Add deps to ssr.external so they are not transformed by Vite when calling ssrLoadModule to load the renderer.
  • Move kleur as dependency as it's used in ssg.ts

Note: Vite's SSR externalization doesn't take into account of loading modules from node_modules hence we got this issue and have to use ssr.external manually. This could be fixed in Vite, but I feel like we should use normal import() to load renderers instead (that would be a breaking change)

Testing

This one's hard to test due to our monorepo structure, however I tested the repro in #4995 which works with this PR.

Existing tests should ideally pass too.

Docs

N/A. should work by default.

@changeset-bot
Copy link

changeset-bot bot commented Oct 10, 2022

🦋 Changeset detected

Latest commit: d14b55c

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

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Oct 10, 2022
Comment on lines -52 to -54
optimizeDeps: {
include: ['image-size'].filter(Boolean),
},
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.

@matthewp matthewp merged commit 2d9d422 into main Oct 10, 2022
@matthewp matthewp deleted the image-strict branch October 10, 2022 15:35
@astrobot-houston astrobot-houston mentioned this pull request Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[@astrojs/image]: ReferenceError: module is not defined
2 participants