You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When bundling code with esbuild and using the dd-trace esbuild plugin, I run into an issue when resolving all dependencies, as some are specified as external for some useless dependencies I'm not using. Yet, dd-trace plugin still tries to resolve them.
Expected behaviour
external packages should not be resolved by the plugin
Actual behaviour
External packages are still resolved, causing issues when they are not added as dependencies
Sample project, with knex for example that has multiple external dependencies not useful, for example mysql if I'm using postgres, etc...
If I still try to add those dependencies, I run into another issue, which is that mysql2 is declared as instrumented, but the resolve is calling the package.json, which is not included in mysql2, causing the export to fail similarly. This would indicate that the list datadog-instrumentations/src/helpers/hooks.js is not entirely compatible.
✘ [ERROR] Package subpath './package.json' is not defined by "exports" in /Users/**/node_modules/mysql2/package.json [plugin datadog-esbuild]
node_modules/dd-trace/packages/datadog-esbuild/index.js:45:40:
45 │ const pathToPackageJson = require.resolve(`${packageName}/package.json`, { paths: [ args.resolveDir ] })
I think an easy fix would be to either:
filter resolved modules on being or not listed as external in esbuild build config.
add the ability for the user to specify a list of excluded modules when specifying the plugin, that would be complementary to the instrumented list provided by datadog.
Environment
Operation system: Macos
Node.js version: 16.19
Tracer version: 4.0
Agent version:
Relevant library versions:
The text was updated successfully, but these errors were encountered:
For the mysql2 problem, I opened a merge request on their repo to allow the resolve to work as expected sidorares/node-mysql2#2026
EDIT : PR has been merged and added to 3.3.3 release
I will test if it allow to fix today, but a support for external dependencies would still be the proper way to go, as this would enforce any user to include all libraries, and make the bundle size much more important
When bundling code with esbuild and using the dd-trace esbuild plugin, I run into an issue when resolving all dependencies, as some are specified as external for some useless dependencies I'm not using. Yet, dd-trace plugin still tries to resolve them.
Expected behaviour
external packages should not be resolved by the plugin
Actual behaviour
External packages are still resolved, causing issues when they are not added as dependencies
Steps to reproduce
Sample project, with knex for example that has multiple external dependencies not useful, for example mysql if I'm using postgres, etc...
If I still try to add those dependencies, I run into another issue, which is that
mysql2
is declared as instrumented, but the resolve is calling the package.json, which is not included inmysql2
, causing the export to fail similarly. This would indicate that the listdatadog-instrumentations/src/helpers/hooks.js
is not entirely compatible.I think an easy fix would be to either:
instrumented
list provided by datadog.Environment
The text was updated successfully, but these errors were encountered: