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

Batch instead of using p-limit #10800

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

horo-fox
Copy link
Contributor

@horo-fox horo-fox commented Apr 17, 2024

cc @jlarmstrongiv

Changes

Potentially fix #10708 (comment). We use p-limit two other places that could probably use a similar strategy, if we want to remove a dependency.

Testing

If possible, I would like to try installing this branch as a package to ensure it still works. I'm not familiar enough with package managers to know how to do that.

Docs

Should just fix a potential import issue.

Copy link

changeset-bot bot commented Apr 17, 2024

🦋 Changeset detected

Latest commit: 33208d5

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 17, 2024
@bluwy
Copy link
Member

bluwy commented Apr 17, 2024

I don't think we should revert it. Our build setup (Vite) already respects subpath imports, it seems like a different tool from that comment that's not supporting it. @jlarmstrongiv do you have a repro?

@jlarmstrongiv
Copy link

Here’s the reproduction https://github.com/jlarmstrongiv/astro-p-limit-error it appears the error occurs with the sst adapter.

I suppose I’m in favor of reverting it because breaking sst builds in a patch release isn’t ideal

@bluwy
Copy link
Member

bluwy commented Apr 17, 2024

I can't get the project to build. I get CredentialsProviderError: Could not load credentials from any providers which perhaps I'm missing some env vars to get this work.

I don't think we're intentionally breaking things here. The package is using subpath imports which should be supported by any tooling that also supports subpath exports. It seems like SST is using esbuild to bundle things:

And AFAIK esbuild also supports subpath imports. So it seems like there's a bug in SST somewhere that prevents it working.

@jlarmstrongiv
Copy link

jlarmstrongiv commented Apr 19, 2024

@bluwy I’ve let SST know in the Discord, I’m assuming they’ll ( @bayssmekanique ) follow up here. Other users have started to confirm astro + sst breaking in Discord too.

I can't get the project to build. I get CredentialsProviderError: Could not load credentials from any providers which perhaps I'm missing some env vars to get this work.

Here’s instructions on ensuring your AWS credentials are set up properly https://docs.sst.dev/advanced/iam-credentials


I don't think we're intentionally breaking things here. The package is using subpath imports which should be supported by any tooling that also supports subpath exports. It seems like SST is using esbuild to bundle things:
And AFAIK esbuild also supports subpath imports. So it seems like there's a bug in SST somewhere that prevents it working.

Your reasoning is sound. SST does use esbuild behind the scenes (so does Vite, which Astro depends on). And it certainly wasn’t international. Nonetheless, it broke all astro + sst builds in a patch update. Hopefully, this issue will be resolved from either the sst side or astro side (in this PR).

@bayssmekanique
Copy link
Contributor

bayssmekanique commented Apr 19, 2024

This does appear to be an issue that will affect more than just sst users. Anyone using Deno, Bun, tsx, or esbuild will face this issue according to the issue comments: sindresorhus/p-limit#75

My understanding is that esbuild doesn't implement the resolution, it relies on Node's implementation, so this could be an issue of the build-time environments node version not being compatible. nvm, I misunderstand Evan's comment but looking at the code he does perform his own module resolution.

@Princesseuh
Copy link
Member

Princesseuh commented Apr 19, 2024

This does appear to be an issue that will affect more than just sst users. Anyone using Deno, Bun, tsx, or esbuild will face this issue according to the issue comments: sindresorhus/p-limit#75

My understanding is that esbuild doesn't implement the resolution, it relies on Node's implementation, so this could be an issue of the build-time environments node version not being compatible. nvm, I misunderstand Evan's comment but looking at the code he does perform his own module resolution.

Looking at esbuild's issues, support for subpath imports was added multiple years ago. Are you saying that it doesn't work even in esbuild's latest version?

The issue you linked mention that Deno has now fixed this.

Bun also supports subpath imports (though there's apparently bugs in it on some OS)

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.

None yet

5 participants