Skip to content

Add commonjs wrappers to components when using require#1288

Merged
matux merged 4 commits into
masterfrom
matux/commonjs-wrappers
Aug 7, 2025
Merged

Add commonjs wrappers to components when using require#1288
matux merged 4 commits into
masterfrom
matux/commonjs-wrappers

Conversation

@matux

@matux matux commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

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.

  • Creates .cjs wrapper files for 8 Rollbar components that re-export the default export from their corresponding .js files
  • Updates package.json exports to point require entries to the new .cjs files instead of .js files
  • Adds an example showcasing this type of integration

SDK-531/add-cjs-for-browser-components-using-require

@matux matux requested a review from Copilot August 7, 2025 20:39
@matux matux self-assigned this Aug 7, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .cjs wrapper files for 8 Rollbar components that re-export the default export from their corresponding .js files
  • Updates package.json exports to point require entries to the new .cjs files instead of .js files

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)

Comment thread src/truncation.cjs Outdated
Comment thread src/tracing/tracing.cjs Outdated
Comment thread src/telemetry.cjs Outdated
Comment thread src/scrub.cjs Outdated
Comment thread src/browser/wrapGlobals.cjs Outdated
Comment thread src/browser/replay/recorder.cjs Outdated
Comment thread src/browser/core.cjs Outdated
Comment thread examples/webpack-require/README.md Outdated
@matux matux requested a review from waltjones August 7, 2025 21:14
@matux matux enabled auto-merge (squash) August 7, 2025 21:15
@matux matux merged commit e3bd8c6 into master Aug 7, 2025
4 checks passed
@matux matux deleted the matux/commonjs-wrappers branch August 7, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants