Skip to content

Commit

Permalink
fix(otlp-exporter-base): use dynamic import instead of require in esm…
Browse files Browse the repository at this point in the history
…/esnext builds
  • Loading branch information
pichlermarc committed Nov 29, 2024
1 parent fc94e46 commit dbc8c5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ class HttpExporterTransport implements IExporterTransport {
async send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {
if (this._send == null) {
// Lazy require to ensure that http/https is not required before instrumentations can wrap it.
const {
sendWithHttp,
createHttpAgent,
// eslint-disable-next-line @typescript-eslint/no-var-requires
} = require('./http-transport-utils');
const { sendWithHttp, createHttpAgent } = await import(
'./http-transport-utils'
);
this._agent = createHttpAgent(
this._parameters.url,
this._parameters.agentOptions
Expand Down
3 changes: 2 additions & 1 deletion experimental/packages/otlp-exporter-base/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"outDir": "build/esm",
"rootDir": "src",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo",
"module": "es2020"
},
"include": [
"src/**/*.ts"
Expand Down

0 comments on commit dbc8c5b

Please sign in to comment.