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

dev mode times out if it imports a function called "then" #13004

Closed
1 task
samuelstroschein opened this issue Jan 18, 2025 · 3 comments
Closed
1 task

dev mode times out if it imports a function called "then" #13004

samuelstroschein opened this issue Jan 18, 2025 · 3 comments
Labels
ecosystem: upstream Upstream package has issue

Comments

@samuelstroschein
Copy link

Astro Info

Astro                    v5.1.7
Node                     v22.11.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

The astro dev mode times out.

  • build && preview works fine
  • the bug seems to occur with larger JS files.
  • a plain vite project has no issue.

Bug emerged in opral/inlang-paraglide-js#313

What's the expected result?

Dev mode does not time out.

Link to Minimal Reproducible Example

https://github.com/samuelstroschein/astro-slow-dev-mode

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 18, 2025
@ascorbic ascorbic added - P3: minor bug An edge case that only affects very specific usage (priority) feat: dev Related to `astro dev` CLI command (scope) and removed needs triage Issue needs to be triaged labels Jan 21, 2025
@ascorbic
Copy link
Contributor

This is such a great bug! I haven't found the root cause, but I'm pretty sure I know what it will look like. Anyway: the workaround is to remove the three exports of the function then(), from messages.js, en.js and de.js. The reason this is happening is almost certainly that somewhere there is somethign that checks if an import is async by seeing if it has a then() export. This is a really common approach, because the interface for "Thenables" is so loose. Something is looking at that import, thinking it's a promise, then waiting for it to resolve (which it never does, because then() isn't a promise callback). I'll see if I can find where this is happening, but it's such an edge case I would suggest you just rename that string for now.

@ascorbic ascorbic added - P2: has workaround Bug, but has workaround (priority) and removed - P3: minor bug An edge case that only affects very specific usage (priority) labels Jan 21, 2025
@samuelstroschein
Copy link
Author

Indeed. I created opral/inlang-paraglide-js#331 to forbid then as the message name. Feel free to close this issue or keep it open.

@riderx
Copy link

riderx commented Jan 22, 2025

Thanks both for that ! Unexpected issue, but clearly my fault !
I’m so glad you found it i will be able to remove my custom implementation !

@ascorbic ascorbic changed the title dev mode times out dev mode times out if it imports a function called "then" Jan 22, 2025
@ematipico ematipico added ecosystem: upstream Upstream package has issue and removed - P2: has workaround Bug, but has workaround (priority) feat: dev Related to `astro dev` CLI command (scope) labels Jan 22, 2025
@ematipico ematipico closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ecosystem: upstream Upstream package has issue
Projects
None yet
Development

No branches or pull requests

4 participants