Hey team how does npm bundling work in
Hey team, how does npm bundling work in convex actions?
Let's say I've got this action
But I see this error in the function response from client and on the dashboard when I run the function through there too:
Let's say I've got this action
'use node';
import { build } from "esbuild";
export const doSomethingWithEsBuild = action({
args: {},
handler: async () => {
// do something with esbuild...
},
});'use node';
import { build } from "esbuild";
export const doSomethingWithEsBuild = action({
args: {},
handler: async () => {
// do something with esbuild...
},
});But I see this error in the function response from client and on the dashboard when I run the function through there too:
Uncaught Error: The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
More information: The file containing the code for esbuild's JavaScript API (/var/task/aws_lambda.cjs) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.
at esbuildCommandAndArgs (../../node_modules/esbuild/lib/main.js:1971:6)
at ensureServiceIsRunning (../../node_modules/esbuild/lib/main.js:2144:14)
at build (../../node_modules/esbuild/lib/main.js:2036:15)
at handler (../../convex/workers/wrangle.ts:16:13)Uncaught Error: The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
More information: The file containing the code for esbuild's JavaScript API (/var/task/aws_lambda.cjs) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.
at esbuildCommandAndArgs (../../node_modules/esbuild/lib/main.js:1971:6)
at ensureServiceIsRunning (../../node_modules/esbuild/lib/main.js:2144:14)
at build (../../node_modules/esbuild/lib/main.js:2036:15)
at handler (../../convex/workers/wrangle.ts:16:13)