I'm trying to use nanoid (https://www.npmjs.com/package/nanoid/v/2.1.2)
exports = async function(){
const nanoid = require("nanoid");
const uid = nanoid(10);
}
From within MongoDB realm runtime, but it throws:
uncaught promise rejection: failed to eval source for module 'nanoid': node_modules/nanoid/index.cjs: Line 9:7 Unexpected identifier (and 16 more errors)
And this is about all the error I can see from the Realm Dashboard.
What could be missing?
The solution that worked for me:
npm i nanoid@2.1.2
Then upload the package to MongoDB Realm functions through the dashboard.