sourcemap files to the Flashduty server. Through sourcemap, frontend developers can more efficiently perform error tracking and debugging.
Users can view uploaded sourcemap files in the “Application Management” - “Source Code Management” menu, and generate scripts through the upload panel to execute uploads locally.
Why Do You Need SourceMap?
In modern frontend development, JavaScript and CSS files are typically minified and obfuscated to optimize loading speed and performance. However, this minification causes code location information in error stacks to not directly map to the original source code, increasing debugging difficulty.Map Minified Code
SourceMap records the mapping relationship between minified code and original code, allowing developers to view unminified source code during debuggingPrecise Error Location
Through
SourceMap, you can directly locate the specific position in the original source code in error trackingImprove Debugging Efficiency
Developers don’t need to manually decode minified files, saving time troubleshooting issues
Generate SourceMap
Most modern build tools (such as Webpack, Rollup, or Vite) support generatingSourceMap.
- Webpack
- Vite
- Rollup
Enable After building, the
SourceMap generation in webpack.config.js:dist directory will contain bundle.js and the corresponding bundle.js.map file.Upload SourceMap
Use Flashduty CLI to uploadsourcemap files to the Flashduty server.
Configure Upload Parameters

Used to authenticate your identity
Application service name (e.g.,
my-service)Application release version (e.g.,
1.0.0)Path prefix for minified files (e.g.,
/assets)SourceMap Management
On the Flashduty platform,sourcemap file management is done through the “Application Management” - “Source Code Management” menu:
| Feature | Description |
|---|---|
| View Uploaded SourceMaps | List all uploaded files, including path, service name, version, size, and upload time |
| Version Management | Manage different application versions separately through service and release-version parameters |
| Permission Control | Ensure only authorized users can upload or manage through API Key |
View Source Code in Error Tracking
RUM integratessourcemap functionality, supporting direct viewing of original source code in the Error Tracking module for precise problem localization.
Capture Frontend Errors
RUM SDK automatically captures frontend errors (such as JavaScript exceptions, Promise rejections, network errors, etc.) and sends error stack information to the server.
Associate SourceMap
When the file path and line number in the error stack match an uploaded Mapped source code:
sourcemap, Flashduty automatically maps the minified code error location to the original source code.Minified file stack:View Error Details
In the Error Tracking module, click a specific error record to view:
- Error message: e.g.,
Something went wrong - Original stack: Mapped source code file path, line number, and column number
- Context code: Display source code snippet near the error location
Best Practices
Standardize SourceMap Upload
Standardize SourceMap Upload
Integrate upload commands in CI/CD pipelines to ensure automatic
sourcemap upload with each release.GitHub Actions Example:Version Management
Version Management
Use the
--release-version parameter to match the application version number for easy tracking of specific version sourcemaps.Clean Up Source Code
Clean Up Source Code
Delete
sourcemap files before uploading resources to CDN to avoid bringing source code information into production.Test Mapping Effect
Test Mapping Effect
After uploading
sourcemap, proactively throw test errors to verify that the Error Tracking module correctly maps to source code.Frequently Asked Questions
Why isn't the error stack mapped to source code?
Why isn't the error stack mapped to source code?
- Confirm that
sourcemapwas successfully uploaded andminified-path-prefixmatches the actual deployment path - Check that
serviceandrelease-versionmatch the application version when the error occurred
How to prevent SourceMap from leaking sensitive information?
How to prevent SourceMap from leaking sensitive information?
- Ensure
sourcemapfiles are only uploaded to the Flashduty server, not directly exposed on the public network - In production, remove direct access to
sourcemapfiles (e.g., through Nginx configuration)
What if SourceMap upload fails?
What if SourceMap upload fails?
- Check if
API Keyis valid - Ensure network connection is normal and CLI version is the latest