elastic / elastic/apm-agent-nodejs

improve ESM support

Open
#4,518 2 comments 3 reactions 0 assignees View on GitHub
community triage
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

**Is your feature request related to a problem? Please describe.**

```
(node:20) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("elastic-apm-node/loader.mjs", pathToFileURL("./"));'
```

`--experimental-loader` is deprecated, and using `--loader` is not recommend

the solution is to create a new file that will register this `loader`

@koa/router instrumentation is not working well with ESM because it uses __dirname, and __dirname does not exist on ESM builds

**Describe the solution you'd like**

improve docs

**Describe alternatives you've considered**

improve docs

**Additional context**

ESM support is lacking

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.