Skip to content

🐞 esm files need to end in .mjs #922

@dynst

Description

@dynst

📝 Description

"import": "./lib/esm/index.js",

🙁 Actual Behavior

Node parses the .js files as CJS, and chokes on ESM syntax.

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1274:20)
    at Module._compile (node:internal/modules/cjs/loader:1320:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    ...

 Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `nodejs --trace-warnings ...` to show where the warning was created)

🤩 Expected Behavior

Packages follow the naming conventions and name CommonJS files .cjs and ESM files .mjs.

🎬 Steps to Reproduce

🧑‍💻 Context

🖥️ Your Environment

Node.js 20.18

  • DMK Version:

latest develop branch

  • Ledger Device Model:
  • Ledger Device OS Version:
  • Connection Method:
  • Application Name and Version:
  • Browser Name and Version:
  • Operating System and Version:
  • Project Link:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug_reportThis is a bug report from issue template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions