build-plugins
build-plugins copied to clipboard
esbuild plugin does not handle esbuild entrypoint objects correctly
Create an in/out entrypoint object in your esbuild config:
const bundlerCtx = await esbuild.context({
// ...
entryPoints: [
{
in: "some/file.ts",
out: "some/file",
},
],
// ...
});
The DataDog esbuild plugin throws an error when trying to call .replace on that entrypoint object (presumably expecting it to be a string):
https://github.com/DataDog/build-plugin/blob/c1825702cf74e85a57d59d2a060ccff7042a1aa2/src/hooks/datadog/metrics/esbuild.ts#L32
[BuildPlugin] Couldn't aggregate metrics: TypeError: fullPath.replace is not a function
at getModulePath (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/hooks/datadog/metrics/esbuild.js:27:31)
at exports.getIndexed (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/hooks/datadog/metrics/esbuild.js:38:31)
at getEsbuildMetrics (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/hooks/datadog/aggregator.js:28:24)
at exports.getMetrics (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/hooks/datadog/aggregator.js:54:25)
at BuildPluginClass.<anonymous> (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/hooks/datadog/index.js:36:36)
at Generator.next (<anonymous>)
at ./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/hooks/datadog/index.js:11:71
at new Promise (<anonymous>)
at __awaiter (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/hooks/datadog/index.js:7:12)
at BuildPluginClass.output (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/hooks/datadog/index.js:32:12)
at applyHook (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/BaseClass.js:75:59)
at BuildPluginClass.<anonymous> (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/BaseClass.js:86:19)
at Generator.next (<anonymous>)
at ./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/BaseClass.js:11:71
at new Promise (<anonymous>)
at __awaiter (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/BaseClass.js:7:12)
at BuildPluginClass.applyHooks (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/BaseClass.js:70:16)
at BuildPluginClass.<anonymous> (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/esbuild/index.js:49:24)
at Generator.next (<anonymous>)
at ./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/esbuild/index.js:11:71
at new Promise (<anonymous>)
at __awaiter (./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/esbuild/index.js:7:12)
at ./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@datadog/build-plugin/dist/esbuild/index.js:31:33
at ./node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1496:33
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
This prevents much of the plugin from working.