Add commonjs wrappers to components when using require#1288
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds CommonJS wrapper files for various Rollbar components to provide compatibility for users who use require() in browser environments. The change enables seamless importing of ES modules through CommonJS syntax.
- Creates
.cjswrapper files for 8 Rollbar components that re-export the default export from their corresponding.jsfiles - Updates package.json exports to point
requireentries to the new.cjsfiles instead of.jsfiles
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/truncation.cjs | CommonJS wrapper for truncation module |
| src/tracing/tracing.cjs | CommonJS wrapper for tracing module |
| src/telemetry.cjs | CommonJS wrapper for telemetry module |
| src/scrub.cjs | CommonJS wrapper for scrub module |
| src/browser/wrapGlobals.cjs | CommonJS wrapper for wrapGlobals module |
| src/browser/telemetry.cjs | CommonJS wrapper for browser telemetry module |
| src/browser/replay/recorder.cjs | CommonJS wrapper for replay recorder module |
| src/browser/core.cjs | CommonJS wrapper for browser core module |
| package.json | Updates export map to use .cjs files for require entries |
Comments suppressed due to low confidence (1)
waltjones
reviewed
Aug 7, 2025
waltjones
approved these changes
Aug 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the change
This PR adds CommonJS wrapper files for various Rollbar components to provide compatibility for users who use require() in browser environments. The change enables seamless importing of ES modules through CommonJS syntax.
SDK-531/add-cjs-for-browser-components-using-require