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
import { tracer } from 'dd-trace'; added automatically by VS Code fails in runtime with:
import { tracer } from "dd-trace";
^^^^^^
SyntaxError: Named export 'tracer' not found. The requested module 'dd-trace' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'dd-trace';
const { tracer } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:146:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:229:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
Node.js v20.18.0
import tracer from 'dd-trace'; works well, also suggested by VS Code and the only import added automatically by WebStorm.
The critical part of the bug is the wrong import is not caught by TypeScript at the time of compilation so it's easy to break the production.
Seems to be related to #4070 (CC @Qard). Tested on lambda x86_64 and Windows 11.
import { tracer } from 'dd-trace';
added automatically by VS Code fails in runtime with:import tracer from 'dd-trace';
works well, also suggested by VS Code and the only import added automatically by WebStorm.The critical part of the bug is the wrong import is not caught by TypeScript at the time of compilation so it's easy to break the production.
Seems to be related to #4070 (CC @Qard). Tested on lambda x86_64 and Windows 11.
[email protected]
[email protected]
[email protected]
package.json with
"type": "module"
tsconfig.json:
Transpiled code:
Minimal reproducible example
The text was updated successfully, but these errors were encountered: