MarcinM
Convex Community16mo ago
4 replies
Marcin

Error: Could not resolve...

I am willing to use nodejs package.

I am following the instruction here: https://docs.convex.dev/functions/bundling

I have setup my convex.json as follows:
{
"node": {
"externalPackages": ["*"]
}
}

Still i got tons of messages like:
---
[ERROR] Could not resolve "events"

node_modules/cli-progress/lib/multi-bar.js:4:30:
4 │ const _EventEmitter = require('events');
~~~~

The package "events" wasn't found on the file system but is built into node. Are you trying to
bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
---

In my code I am importing the package:
---
import nodejspackage from "nodejs-package";
---

What I am doing wrong so it does not work?
Bundling is the process of gathering, optimizing and transpiling the JS/TS
Bundling | Convex Developer Hub
Was this page helpful?