In react (next JS) I can import and use mongodb fine in a server component. However, when I try to import the server component into a client component I get the following error:
Module not found: Can't resolve 'mongodb-client-encryption' in 'C:\...'
Import trace for requested module:
./node_modules/mongodb/lib/deps.js
./node_modules/mongodb/lib/client-side-encryption/client_encryption.js
./node_modules/mongodb/lib/index.js
./app/lib/mongodb.js
./app/components/ig-report/reportOverviewTable.js
./app/reportdisplay/page.js
This is occurring for the following dependencies:
mongodb-client-encryption
aws4
socks
snappy
gcp-metadata
aws-sdk
zstd
kerberos