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

BSON exports causing confusion

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • 2

      I am migrating my project to use the Metro bundler in Expo and I am having enormous difficulties importing ObjectId from BSON. My code has always worked when running natively (React Native) but has stopped working when running in the browser (Expo Web).

      This is the same issue as in NODE-5816 but the suggested solution of enabling the topLevelAwait flag in webpack won't work for me since I'm using Metro not webpack and I can't readily see an alternative solution.

      But! I wonder if there is something more to this than just a bundler configuration issue. I am not doing anything particularly novel, I'm using Expo for web which is fairly popular. The user in the other issue was using NextJS which is incredibly popular. I don't claim to understand this but it seems strange that when making this migration I am only facing this issue with this library. Could it be that the exports in this library could be improved?

      I was interested to see NODE-5057 where a Mongo engineer has requested a change be made to the exports to accommodate what looks like exactly the same issue when using this library in compass. Why did this engineer not simply resolve this bundler configuration issue?

      I'm therefore wondering if there is a case for looking at this again and seeing if the exports for this module really make sense.

            Assignee:
            bailey.pearson@mongodb.com Bailey Pearson
            Reporter:
            robert@staxy.live Robert Nash
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: