Skip to content

Loader docs return value for source from transform? #35

Open

Description

@jonaskello

I think the most current docs for the loader hooks are here:

https://github.com/nodejs/node/blob/master/doc/api/esm.md#loadurl-context-defaultload

In the section above in the table for formats, it has a column called

Acceptable types For source returned by resolve or load

This leads me to believe that resolve somehow would be capable of returning source but I think it is not? Is this an error in the docs or have I misunderstood something?

Activity

  1. GeoffreyBooth commented on Sep 25, 2021

    @GeoffreyBooth
    Member

    It should probably say acceptable values for format; @JakobJingleheimer ?

  2. jonaskello commented on Sep 25, 2021

    @jonaskello
    Author

    The format is specified in the first column so I think it the resolve part should just be removed?

    Acceptable types For source returned by resolve or load

  3. JakobJingleheimer commented on Sep 27, 2021

    @JakobJingleheimer
    Member

    It should probably say acceptable values for format; @JakobJingleheimer ?

    @GeoffreyBooth the 3rd column is indeed types for source. That table is saying when format is foo, source can be bar. I'm not sure how much value the table provides (it existed before though) as in most circumstances, the choice is made for you.

    Acceptable types For source returned by ~resolve or ~load

    Yes! resolve does not return a source property. Thank you for the catch @jonaskello. PR incoming.

  4. JakobJingleheimer commented on Sep 27, 2021

    @JakobJingleheimer
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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