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 check CLI fs load fallback behaviour #6811

Merged
merged 2 commits into from
Apr 11, 2023
Merged

Fix check CLI fs load fallback behaviour #6811

merged 2 commits into from
Apr 11, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Apr 10, 2023

Changes

Fix #6629

In vite-plugin-load-fallback, the fs check wasn't right when the fs is from import * as fs from 'fs'. This PR fixes it.

I also simplified the resolveId hook as the this.resolve and always slashify part doesn't seem necessary. Other plugins should've already resolve before the load-fallback plugin, and always slashify makes it impossible for a plugin to run this.resolve to check if an id is resolveable (e.g. tsconfig-alias plugin baseUrl)

Testing

Existing tests should pass. The edgecase in #6629 is a little hard to test, but once I do some tsconfig aliases soon, the regression shouldn't happen again.

Docs

n/a. bug fix.

@changeset-bot
Copy link

changeset-bot bot commented Apr 10, 2023

🦋 Changeset detected

Latest commit: 2cc09bc

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: astro Related to the core `astro` package (scope) label Apr 10, 2023
@bluwy bluwy mentioned this pull request Apr 10, 2023
1 task
Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

I don't completely understand the code here (I'm not 100% sure why sync needs to be passed an instance of fs, I assume it's for tests?), but nonetheless the code make sense and the tests pass, so it looks good to me

@bluwy
Copy link
Member Author

bluwy commented Apr 11, 2023

Yeah sync is passed with fs so it can be unit-tested to swap out the fs

@bluwy bluwy merged commit 60c16db into main Apr 11, 2023
@bluwy bluwy deleted the check-fs-fallback branch April 11, 2023 03:57
@astrobot-houston astrobot-houston mentioned this pull request Apr 11, 2023
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.

2.1.5 regression: astro check fails with “astro sync command failed to generate content collection types”
3 participants