Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esbuild plugin does not handle esbuild entrypoint objects correctly #60

Closed
Cldfire opened this issue Mar 8, 2024 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@Cldfire
Copy link

Cldfire commented Mar 8, 2024

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.

@Cldfire Cldfire added the bug Something isn't working label Mar 8, 2024
@yoannmoinet
Copy link
Member

Thanks for the heads up, sorry for the delay.
We're currently revamping the plugin, and this will be covered in the next major release.

This was referenced May 14, 2024
@yoannmoinet
Copy link
Member

Fixed in v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants