Skip to content

Commit

Permalink
[Issue #2696] add New Relic to Next app (#2922)
Browse files Browse the repository at this point in the history
* code added as per direction from New Relic documentation and example Next app in order to add necessary fronted scripts for tracking timing
* custom typing added to plaster over deficiencies in supplied New Relic TS definitions
* support for necessary environment variables added in infra code
  • Loading branch information
doug-s-nava authored Nov 26, 2024
1 parent f43e6e9 commit f51f5db
Show file tree
Hide file tree
Showing 8 changed files with 1,235 additions and 105 deletions.
6 changes: 6 additions & 0 deletions frontend/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ API_AUTH_TOKEN=LOCAL_AUTH_12345678
# Boolean to switch between mock data and live API call data
# Default is a live API call
USE_SEARCH_MOCK_DATA=false

# Credentials for DEV Next New Relic Account (see 1pass)
# Best practice is to pass these in the command line when you start your dev server rather than entering them here
# DO NOT COMMIT THESE VALUES TO GITHUB
NEW_RELIC_APP_NAME=
NEW_RELIC_LICENSE_KEY=
8 changes: 8 additions & 0 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const withNextIntl = require("next-intl/plugin")("./src/i18n/server.ts");
const sassOptions = require("./scripts/sassOptions");
const nrExternals = require("@newrelic/next/load-externals");

/**
* Configure the base path for the app. Useful if you're deploying to a subdirectory (like GitHub Pages).
Expand All @@ -21,6 +22,13 @@ const nextConfig = {
// https://nextjs.org/docs/app/api-reference/next-config-js/output
output: "standalone",
sassOptions: appSassOptions,
experimental: {
serverComponentsExternalPackages: ["newrelic"],
},
webpack: (config) => {
nrExternals(config);
return config;
},
};

module.exports = withNextIntl(nextConfig);
Loading

0 comments on commit f51f5db

Please sign in to comment.