ncc
ncc copied to clipboard
New Relic fails to load supported packages
When using ncc with a project that requires newrelic, the agent fails loading the files required for instrumentation:
{"msg":"Tried to load instrumentation from /var/app/globals.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/child_process.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/crypto.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/dns.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/fs.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/http.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/http.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/inspector.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/net.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/timers.js, but file does not exist","component":"shimmer"}
{"msg":"Tried to load instrumentation from /var/app/core/zlib.js, but file does not exist","component":"shimmer"}
{"msg":"Failed to load instrumentation for @newrelic/koa {\"code\":\"MODULE_NOT_FOUND\",\"requireStack\":[\"/var/app/empty.js\"]}","component":"shimmer"}
{"msg":"Failed to load instrumentation for @newrelic/superagent {\"code\":\"MODULE_NOT_FOUND\",\"requireStack\":[\"/var/app/empty.js\"]}","component":"shimmer"}
Is there a way I can get those files to be included int he bundle?
I have managed to circumvent this obstruction. But it would be much nicer to have a proper fix. Maybe it will help others too.
Use --external newrelic flag.
ncc build my-index.js -o build --external newrelic
newrelic now needed to be installed externally - for example globally using npm or yarn