Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-3198

mongodb@3.6.6 release breaks Yarn v2 PnP

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.7
    • Affects Version/s: 3.6.6
    • Component/s: None
    • Not Needed

      Release of `mongodb@3.6.6` in NPM included a change from `require_optional` to `optional-require`. These two packages take different approaches to optional `require`s: `require_optional` checks for explicit `peerOptionalDependencies`, while `optional-require` tries to `require` and ignores certain error messages. With Yarn v2 PnP, the "Module Not Found" error message is atypical, so `optional-require` does not ignore it; as a result, `requireOptional('mongodb-extjson')` (for example) throws an error when it is not installed in the application. This is a breaking change from `mongodb@3.6.5`.

      I have opened a pull request for `optional-require` to add support for Yarn v2 PnP. Once that PR is accepted, there should be no action required for `mongodb`, besides optionally upgrading the dependency on `optional-require`. Alternatively, `mongodb` could re-introduce the `try-catch` blocks around `requireOptional` that were removed in `mongodb@3.6.6`.

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            marc@unqork.com Marc Hassan
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: