Skip to content

NPM deep Mongo dependency conflicts with Meteor's mongo package #13696

@welkinwong

Description

@welkinwong

Meteor 3.2

After installing an npm package with Mongo dependencies, Meteor fails with this error:

welkin@Mac issue-top-level-await2 % meteor                                                                   
[[[[[ ~/code/issue-top-level-await2 ]]]]]     

=> Started proxy.                             
=> Started HMR server.                        
=> Errors prevented startup:                  
   
   While building for web.browser:
   node_modules/bson/lib/bson.mjs:239:28: Unexpected reserved word 'await'. (239:28)
   
=> Your application has errors. Waiting for file change.
=> Started MongoDB.

This is a minimal reproducible example.
https://github.com/welkinwong/issue-top-level-await

PS: After resetting everything, the error still persists, so it's unlikely to be cache-related.

meteor reset && rm -rf package-lock.json && rm -rf node_modules && meteor npm i && meteor

The error only occurs when a Meteor package in my /packages directory imports and uses Mongo. This makes me suspect a potential conflict between the two Mongo.

in /packages/abc/

import mongo from 'mongodb';
mongo;

install npm meteor npm i sharedb-mongo
This npm package has a Mongo dependency.


Apologies if my explanation isn't perfect - I'm doing my best to explain this tricky issue. Really appreciate any help!

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions