Welcome to Highlight
Getting Started
Overview
Backend / Server
Client / Frontend
Fullstack Frameworks
Tips
Content-Security-Policy
Local Development
Monkey Patches
Performance Impact
Proxying Highlight
Session Search Deep Linking
Troubleshooting
Upgrading Highlight
Session Replay
Console Messages
HTML iframe Recording
Identifying Users
Live Mode
Network DevTools
Privacy
Rage Clicks
Recording Network Requests and Responses
Session Sharing
Session Shortcut
Tracking Events
Versioning Sessions
Error Monitoring
Grouping Errors
Sourcemaps
Versioning Errors
Product Features
Alerts
Analytics
Canvas
Comments
Environments
Frontend Observability
Keyboard Shortcuts
Performance Data
Segments
Session Search
Team Management
User Feedback
Web Vitals
WebGL
Integrations
Amplitude Integration
Clearbit Integration
Electron Integration
Front Plugin
Intercom Integration
Linear Integration
Mixpanel Integration
React.js Integration
Segment Integration
Sentry Integration
Slack Integration
Vercel Integration
highlight.run Changelog
5.0.0
5.0.1
5.1.0
5.1.1
5.1.2
5.1.3
5.1.4
5.1.5
Menu
Docs / Getting Started / Fullstack Frameworks / withHighlightConfig()

withHighlightConfig()

withHighlightConfig = (config: NextConfig, highlightOpts?: HighlightConfigOptions): NextConfig
Copy
Purpose

You can wrap your next.config.js settings with this function to automatically configure source map uploading and creating a rewrite to proxy Highlight requests. This function:

  • Sets productionBrowserSourceMaps=true

  • Adds a rewrite rule to return HTTP 404 for any .map files (to keep source map files private)

  • Uploads source maps to Highlight following any production build

  • Adds a rewrite rule from /highlight-events to pub.highlight.run for Highlight request proxying

Example Usage
import { withHighlightConfig } from '@highlight-run/next' export default withHighlightConfig({ // your next.config.js options here })
Copy
Options

uploadSourceMaps : optional boolean

  • Explicitly enable or disable source map uploading during production builds. By default, source maps are uploaded if both:

    • NextConfig.productionBrowserSourceMaps is not true

    • An API key is set through the apiKey option or HIGHLIGHT_SOURCEMAP_UPLOAD_API_KEY environment variable

configureHighlightProxy : optional boolean, default true

  • Configures a rewrite at /highlight-events for proxying Highlight requests.

apiKey : optional string

  • API key used to link to your Highlight project when uploading source maps. This can also be set through the HIGHLIGHT_SOURCEMAP_UPLOAD_API_KEY environment variable.

appVersion : optional string

  • App version used when uploading source maps.

sourceMapsPath : optional string, default '.next/'

  • File system root directory containing all your source map files.

sourceMapsBasePath : optional string default '_next/'

  • Base path to append to your source map URLs when uploaded to Highlight.