I’m following the instructions mentioned in https://www.npmjs.com/package/@newrelic/browser-agent#new-relic-browser-agent; unfortunately, when my application reaches the import statement, it fails.
import { BrowserAgent } from '@newrelic/browser-agent/loaders/browser-agent'
const options = {
init: { distributed_tracing: { enabled: true }, privacy: { cookies_enabled: true }, ajax: { deny_list: ["bam.nr-data.net"] } },
info: { beacon: "bam.nr-data.net", errorBeacon: "bam.nr-data.net", licenseKey: "xxx", applicationID: "xxx", sa: 1 },
loader_config: { accountID: "xxx", trustKey: "xxx", agentID: "xx", licenseKey: "xx", applicationID: "xx" }
}
new BrowserAgent(options)
The exception I receive is
./src/App.tsx
Module not found: Can’t resolve ‘@newrelic/browser-agent/loaders/browser-agent’ in ‘~/code/clients/web/ClientApp/src’
I assumed it’s because project isn’t set up for using @
references, would have to update tsconfig.json
; so I added the following to the tsconfig
{
"compilerOptions": {
"paths": {
"@/*": [
"./*"
],
}
}
}
packages.json
"scripts": {
"prepare": "cd ../.. && husky install Sontiq.Unified.Web/ClientApp/.husky",
"build-css": "cross-env PUBLIC_URL=/app sass src/Assets/css:public/css --style=compressed --no-source-map",
"watch-css": "cross-env PUBLIC_URL=/app npm run build-css && sass src/Assets/css:public/css --watch --update --style=compressed --no-source-map",
"start": "rimraf ./build && npm-run-all -p watch-css start-js",
"build": "cross-env PUBLIC_URL=/app npm run build-css && cross-env PUBLIC_URL=/app DISABLE_ESLINT_PLUGIN=true react-scripts build",
"start-js": "cross-env PUBLIC_URL=/app DISABLE_ESLINT_PLUGIN=true react-scripts start",
"test": "cross-env CI=true DISABLE_ESLINT_PLUGIN=true react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
4