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

Chunk Load Timeout #10054

Open
espretto opened this issue Dec 16, 2024 · 2 comments
Open

Chunk Load Timeout #10054

espretto opened this issue Dec 16, 2024 · 2 comments

Comments

@espretto
Copy link

🙋 feature request

The timeout for script tags loading chunks should be configurable.

🤔 Expected Behavior

The configured timeout should apply to script tags loading chunks.

😯 Current Behavior

The timeout for script tags loading chunks is currently left up to the browser implementation. iOS v17.5 has a much shorter timeout (120sec) than most other browsers (5min)

💁 Possible Solution

A config variable needs to be created and consumed by the code section below. Ideally, the timeout would be approached w/ a retry strategy if the browser's native timeout is shorter.

script.onerror = function (e) {

🔦 Context

I am recording a constant percentage of non-trivial traffic failing to lazy-load chunks w/ parcel missing out on crucial functionality (consent management platform).

💻 Examples

Webpack has an option chunkLoadTimeout. This should be very useful to parcel users as well.

@devongovett
Copy link
Member

Most of the time we don't use that loader. It's only used if the browser target doesn't support ES modules natively, which is now very rare. I don't think there's a way to configure the native dynamic import() timeout.

@espretto
Copy link
Author

espretto commented Dec 17, 2024

Alright, I cannot share the full sentry issue here but most events are reported by devices with iOS 17 & 18. Those usually support dynamic imports so maybe the feature detection/fallback mechanism doesn't work as expected? EDIT: Or maybe the build target is set too low?

I see that import() doesn't allow to configure a timeout directly but if the returned promise is rejected sooner than the proposed/configured timeout, this could trigger a retry-strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants