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
We do not currently support ES modules. If we do add support in the future, we will likely support both setups.
I would recommend adding a thumbs-up to this issue: #553.
That being said, your error is something I haven't seen when using the agent with ES modules. Typically, if you import the agent it loads fine. There has been some issue with the config file, which an external contribution has allowed us to load 'newrelic.cjs' files now.
As such, you might try renaming your newrelic.js config file to newrelic.cjs and then use import to import our newrelic package as a CommonJS module.
At that point... I don't expect any instrumentation to work but you likely can use the API.
Closing this as we will track things through the feature-request I shared above but happy to continue chatting about getting the import to work.
The
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /project/newrelic.js
occurs when loadingnewrelic
from a package using ES Module.Expected Behavior
newrelic
package.json
file should include either"module": "./index.mjs"
or:Steps to Reproduce
Create a npm package with
"type": "module"
inpackage.json
.Add & configure
newrelic
.Run server.
The text was updated successfully, but these errors were encountered: