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

fix(images): Move emitESMImage util to another file #6505

Merged
merged 2 commits into from
Mar 13, 2023

Conversation

Princesseuh
Copy link
Member

@Princesseuh Princesseuh commented Mar 10, 2023

Changes

emitESMImage depends on rootRelativePath which depends on vite. As such, we need to be careful when importing it because importing it in the wrong context will cause a bunch of weird issues due to Vite trying to load things it shouldn't be loading (such as itself). Since it was in internal.ts, which gets imported from other sources, it would get imported sometimes in the wrong contexts.

This was very confusing, but I think this work

Testing

Tests should still pass! I tested manually that this fix the issue I was running into, as it couldn't be reproduced either in local or in CI

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Mar 10, 2023

⚠️ No Changeset found

Latest commit: b13e737

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 10, 2023
@Princesseuh Princesseuh marked this pull request as ready for review March 10, 2023 15:45
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

@Princesseuh from your point of view, how do you think we can prevent this issue from happening again?

@Princesseuh
Copy link
Member Author

@Princesseuh from your point of view, how do you think we can prevent this issue from happening again?

Unfortunately, I do not know. Generally we avoid this kind of situation by having things in dev folders so we know that we can use them safely, but this case is different because it was because the file was honestly getting mixed up in some weird import mess. The error also only happened in local, in certain situations, nether tests or CI replicated it 🤷‍♀️

@Princesseuh Princesseuh merged commit f55b482 into main Mar 13, 2023
@Princesseuh Princesseuh deleted the fix/image-import-mess branch March 13, 2023 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants