Skip to content

Commit 3abb731

Browse files
committed
adding a warning, trying to fix linter
1 parent 5d7b45e commit 3abb731

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

integration-tests/esbuild.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ try {
2727
console.error(err)
2828
process.exit(1)
2929
} finally {
30-
process.chdir(CWD)
30+
process.chdir(CWD)
3131
}

integration-tests/esbuild/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,9 @@
1616
"apm"
1717
],
1818
"author": "Thomas Hunter II <tlhunter@datadog.com>",
19-
"license": "ISC"
19+
"license": "ISC",
20+
"dependencies": {
21+
"esbuild": "0.16.12",
22+
"express": "^4.16.2"
23+
}
2024
}

packages/datadog-esbuild/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ const NAMESPACE = 'datadog'
33
const instrumented = Object.keys(require('../datadog-instrumentations/src/helpers/hooks.js'))
44
const rawBuiltins = require('module').builtinModules
55

6+
warnIfUnsupported()
7+
68
const builtins = new Set()
79

810
for (const builtin of rawBuiltins) {
@@ -88,3 +90,13 @@ module.exports.setup = function (build) {
8890
}
8991
})
9092
}
93+
94+
function warnIfUnsupported() {
95+
const [major, minor] = process.versions.node.split('.').map(Number);
96+
if (major < 14 || major == 14 && minor < 17) {
97+
console.error('WARNING: Esbuild support isn\'t available for older versions of Node.js.')
98+
console.error(`Expected: Node.js >= v14.17. Actual: Node.js = ${process.version}.`)
99+
console.error('This application may build properly with this version of Node.js, but unless a')
100+
console.error('more recent version is used at runtime, third party packages won\'t be instrumented.')
101+
}
102+
}

0 commit comments

Comments
 (0)