Skip to content

How to stub ES module imports documentation is incorrect #2714

Description

@AniaMakes

Documentation was added in #2676 (~2 months ago)

I tried following it and discovered that it is, in fact, incorrect, at least when using the most recent version of esm.

The set up file, according to the instructions, should look like this:

require = require("esm")(module, {
  cjs: true,
  mutableNamespace: true,
});

however, if you look on esm documentation (https://www.npmjs.com/package/esm#options), you can see that mutableNamespace is NOT a top-level key. It should be set up like this:

require = require("esm")(module, {
  cjs: {mutableNamespace: true}
});

Given that the foundation of this documentation is incorrect, it makes me doubt if this has actually been verified by a human, and I think that incorrect docs are worse than no docs at all.

I hope you are able to either delete the file, or mark it as "unverified" tutorial, after updating the esm config.
Thank you in advance

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