Just wondering if anyone has gotten mikro-orm setu...
# help
Just wondering if anyone has gotten mikro-orm setup with serverless stack? After following the setup process for mikro-orm I'm getting build errors:
Copy code
node_modules/@mikro-orm/core/utils/Configuration.js:230:61: error: Could not resolve "@mikro-orm/mongodb" (mark it as external to exclude it from the bundle)
    230 │ ...Name: 'MongoDriver', module: () => require('@mikro-orm/mongodb') },
        ╵                                               ~~~~~~~~~~~~~~~~~~~~

 > node_modules/@mikro-orm/core/utils/Configuration.js:232:65: error: Could not resolve "@mikro-orm/mariadb" (mark it as external to exclude it from the bundle)
    232 │ ...me: 'MariaDbDriver', module: () => require('@mikro-orm/mariadb') },
I'm using mysql driver and its the only driver that doesn't error since I've installed it, wondering why this is happening and if I need to maybe use a custom esbuild config?
This seems like an issue with mikro orm not treating the mongodb driver as an optional dep
Hey thanks for the reply, I've used tsc to compile mikro-orm to js files before it worked like a charm. So I'm trying to use an esbuild plugin that helps with that but it seems the typescript defintion doesn't have
option available as shown in the docs
afaik you shouldn't need to do this, let me try to recreate this issue later today
Using tsc to compile kind of removes the point of esbuild
One workaround you can try is adding
the thing mikroorm is doing with
() => require
isn't standards compliant which is why esbuild is having trouble with it
That workaround should work as long as mongo isn't actually required
oh nice thanks for that! 🎉 I just tried it and it passes the build, hope there is no runtime errors now as I read esbuild didn't support
Can confirm esbuild does not support
but I just need to manually specify the types so its at least working Thanks for the help @thdxr