mh15
mh153mo ago

Installing `@swc/core` in Convex NodeJS Actions

I get these errors
The package "assert" 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.

✘ [ERROR] Could not resolve "@swc/wasm"

../../node_modules/.pnpm/@swc+core@1.12.0/node_modules/@swc/core/index.js:71:35:
71 │ fallbackBindings = require("@swc/wasm");
╵ ~~~~~~~~~~~

You can mark the path "@swc/wasm" as external to exclude it from the bundle, which will remove
this error and leave the unresolved path in the bundle. You can also surround this "require" call
with a try/catch block to handle this failure at run-time instead of bundle-time.
The package "assert" 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.

✘ [ERROR] Could not resolve "@swc/wasm"

../../node_modules/.pnpm/@swc+core@1.12.0/node_modules/@swc/core/index.js:71:35:
71 │ fallbackBindings = require("@swc/wasm");
╵ ~~~~~~~~~~~

You can mark the path "@swc/wasm" as external to exclude it from the bundle, which will remove
this error and leave the unresolved path in the bundle. You can also surround this "require" call
with a try/catch block to handle this failure at run-time instead of bundle-time.
I've set up my convex.json to mark all packages as external, but no luck.
3 Replies
Convex Bot
Convex Bot3mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
erquhart
erquhart2mo ago
You'll need to add "use node" to files using this

Did you find this page helpful?