bson node es6 module import issue inside react app

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Unknown
    • None
    • Affects Version/s: 6.8.0
    • Component/s: BSON
    • 3
    • Not Needed
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      Using bson module 6.8.0 inside a nextjs app (with app router) produces the following error:
      ```

      Unhandled Runtime Error

      Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check the render method of `StaticGenerationSearchParamsBailoutProvider`.

      ```

      Reproduce

      • Use `npx create-next-app` with app router and typescript
      • Install __ bson module `npm i bson`
      • Create a source file test.ts where to import BSON and export a function that uses BSON.deserialize()
      • Import that test.ts inside a React Component that uses the previously exported function that uses BSON.deserialize()

      Something's wrong around module import/export somewhere. I'll try to publish a public github with this minimal reproduction scenario.

            Assignee:
            Warren James
            Reporter:
            Sébastien PERIN
            None
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: