Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1895

Warning about ESM require() on Node.js 23/homebrew

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.4
    • Affects Version/s: None
    • Component/s: CLI Module
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • 3
    • Not Needed
    • Developer Tools

      Homebrew auto-updates mongosh users to the latest Node.js version. Node.js 23 supports require() for ESM modules, but prints a warning about it.

      https://github.com/mongodb-js/devtools-shared/blob/7aeaac8a2ce1fbfea381d93520544919fc4f59b9/packages/devtools-proxy-support/src/fetch.ts#L20

      attempts to load node-fetch first via plain import(), which gets transpiled to require() (so that it works fine in webpack'ed applications), which failed in non-webpack'ed environments before Node.js 23 but now succeeds with the warning.

            Assignee:
            nikola.irinchev@mongodb.com Nikola Irinchev
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: