Skip to content

Make Basic example from the README runnable in CommonJS environment #2378

Open
@uglide

Description

@uglide

The basic example in the README makes many assumptions about user environment and skills like a proper type field set in the closest package.json, or the user has copy-pasted the example to a file with .mjs extension.

In most cases, users will face the following problems:

  • (node:59910) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
  • SyntaxError: await is only valid in async functions and the top level bodies of modules
  • No clear output is made, so it's hard to determine whether the example was executed successfully or not

Environment:

  • Node.js Version: v19 or any
  • Redis Server Version: Any
  • Node Redis Version: Any
  • Platform: Any

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationEvaluatingThis ticket is still taken into consideration without a clear path forward.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions