question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The support with ES6 module is not provided.

Description

When we define type: “module” and define our new relic config as newrelic.cjs. The file is not found as the default file named to include the named as a constant const DEFAULT_FILENAME = 'newrelic.js' and hence the cjs file is not included.

Expected Behavior

The newrelic.cjs file should be considered for importing.

Steps to Reproduce

  1. Create New Express project.
  2. Add type: “module” in package.json
  3. Create file newrelic.cjs (require will not work in modules. we have to use import).
  4. Import ‘newrelic’ in the start file.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:55
  • Comments:30 (14 by maintainers)

github_iconTop GitHub Comments

9reactions
jedashfordcommented, Nov 5, 2021

I didn’t know people were still using common js. Most examples for libraries and services are all esm. Your competitors have been supporting this for a long time. https://docs.datadoghq.com/tracing/setup_overview/setup/nodejs/?tab=containers

6reactions
bizob2828commented, Sep 21, 2022

I think our wires got crossed internally around flipping the switch on making it public. Either way be on the look out for 9.1.0 release of agent with support for ESM.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does it take to support Node.js ESM? – The Guild
I have worked on all The Guild's libraries and graphql-js to support ESM. Here is how you can do it too.
Read more >
Getting Started with (and Surviving) Node.js ESM
The Node.js ecosystem is shifting towards ESM. We examine what lies in store for application and library authors, learn some of challenges ...
Read more >
ECMAScript modules | Node.js v19.3.0 Documentation
Node.js fully supports ECMAScript modules as they are currently specified and ... Caveat: The ESM load hook and namespaced exports from CommonJS modules...
Read more >
"ESM" | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
supports-esm - npm
Detect at runtime if Node.js supports ECMAScript modules. ... Start using supports-esm in your project by running `npm i supports-esm`.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found