Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Retry failed dynamic import #80

@Snapstromegon

Description

@Snapstromegon

TLDR: Retrying a once failed dynamic import is not possible without hacking around the browser and spec and this leads once failed imports to get blocked for the whole session.

In the current version of the proposal it's declared, that a once failed import should always fail in the future (1.1.2 - 3).
In my understanding this came from the fact, that a once resolved import should always return the same module instance so two calls to the same import don't retrigger the module setup.

To this point I'm completely in favour of the proposal since it matches as closely as possible the static import.

But if we now change from successful imports to a failed import I can't see the need to not retry an earlier failed import. A typical usecase would be to have a single page app which loads custom elements as modules as they are needed. If a user now has a short network outage he will never during his session be able to reimport that module (a hacky workaround is to add a nonce to the url, but that also breaks the "each module is only instantiated once" rule since now one module becomes two).

In my opinion a call to import should work the following way:

Untitled Diagram

That way it's possible to retry a failed import and you don't need to hack around the browser and specification like described above. This would not touch static import in any way and there's already the misconception out there that dynamic import is retryable.

If there is any reason except for ease of implementation for the browsers to keep the current behavior for dynamic import, please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions