Skip to content

Default export versus named { Fetch } export #75

@vrugtehagel

Description

@vrugtehagel

This package provides both a default export, which is intended to be the "main" Fetch function as used in the documentation. However, there's also a named { Fetch } export, which is a renamed createRemoteAssetCache. There was some confusion over this; a user wrote { Fetch }, which did not throw an error, but instead mysteriously returned a RemoteAssetCache object even though {type: 'json'} was passed.

My guess is that this was done for backwards compatibility, but it is confusing for developers nevertheless, especially because the docs isn't very up-front about this. It shows the default import only, sure, but it is an easy mistake to add the curlies, and the lack of an immediate error makes it easy to miss.

For the next major release I would suggest renaming the exports; either do not export a named { Fetch } at all, or have it be an alias to the default export; the createRemoteAssetCache function can be exported under its own name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis will have to be included with a major version as it breaks backwards compatibility.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions