Install source maps with bundlers
Configure Webpack or Rollup/Vite bundlers to automatically upload source maps to Grafana Cloud during builds.
Note
The source map upload endpoint differs from the Faro Collector endpoint. Use the endpoint shown in Frontend Observability > Settings > Source Maps > Configure source map uploads.
Faro bundler plugins support client-side rendered applications only. Server-side rendering isn’t supported. Next.js client-side apps may need _next/ path adjustments using the nextjs option.
Webpack plugin
npm install --save-dev @grafana/faro-webpack-pluginor
yarn add --dev @grafana/faro-webpack-pluginRollup/Vite plugin
npm install --save-dev @grafana/faro-rollup-pluginor
yarn add --dev @grafana/faro-rollup-pluginWebpack configuration
Add the plugin to your webpack.config.js:
// other imports
import FaroSourceMapUploaderPlugin from '@grafana/faro-webpack-plugin';
module.exports = {
// other configs
plugins: [
// other plugins
new FaroSourceMapUploaderPlugin({
appName: '$your-app-name',
endpoint: '$your-faro-sourcemap-api-url',
apiKey: '$your-api-key',
appId: '$your-app-id',
stackId: '$your-stack-id',
gzipContents: true,
// Set skipUpload: true to upload later with CLI
// skipUpload: true,
}),
],
};Rollup/Vite configuration
Add the plugin to your rollup.config.js or vite.config.js:
// other imports
import faroUploader from '@grafana/faro-rollup-plugin';
export default defineConfig(({ mode }) => {
return {
// other configs
plugins: [
// other plugins
faroUploader({
appName: '$your-app-name',
endpoint: '$your-faro-sourcemap-api-url',
apiKey: '$your-api-key',
appId: '$your-app-id',
stackId: '$your-stack-id',
gzipContents: true,
// Set skipUpload: true to upload later with CLI
// skipUpload: true,
}),
],
};
});Configuration options
Configure bundler plugins with these options:
Required options:
appName: string- Application name that matches your Faro Web SDK configurationendpoint: string- Source map API endpoint from Frontend Observability > Settings > Source Maps > Configure source map uploadsapiKey: string- API key withsourcemaps:read,sourcemaps:write, andsourcemaps:deletescopesappId: string- Application ID that matches your Faro Web SDK configurationstackId: string- Grafana Cloud stack ID
Optional options:
outputPath: string- Override output directory path for source maps. Uses bundler output path by defaultoutputFiles: string[] | RegExp- List of source map files or regex pattern to match. Uploads all source maps by defaultbundleId: string- Bundle/build ID. Auto-generated by defaultkeepSourcemaps: boolean- Keep source maps in generated bundle after uploading. Default:falsegzipContents: boolean- Compress source maps before uploading. Default:trueverbose: boolean- Enable detailed logging during upload. Default:falseskipUpload: boolean- Skip uploading during build and export bundle ID to environment file. Default:falsemaxUploadSize: number- Maximum upload size in bytes for single batch. Default: 30MBrecursive: boolean- Recursively search subdirectories for source maps. Default:falsenextjs: boolean- Webpack only. Prepend_next/to file properties for Next.js compatibility. Default:false
Verify source maps
After building your application, verify uploads in Frontend Observability by navigating to your app > Settings > Source Maps. If you set skipUpload: true, complete the upload using the CLI.
For troubleshooting common issues, refer to Troubleshooting.



