Do a commonjs dist file for node, when using require plus example#1287
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new CommonJS distribution build specifically for Node.js applications that use require() instead of import to integrate Rollbar.
- Adds webpack configuration to build a CommonJS distribution file for Node.js
- Updates package.json to point to the new dist file for CommonJS usage
- Removes the existing CJS wrapper file and creates a proper webpack build
- Includes an example Node.js application demonstrating the CommonJS usage
Reviewed Changes
Copilot reviewed 5 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| webpack.config.cjs | Adds new server CJS build configuration and modernizes variable declarations |
| src/server/rollbar.cjs | Removes the existing CommonJS wrapper file |
| package.json | Updates main entry and require paths to point to new dist file, adds webpack-node-externals dependency |
| examples/node-require/package.json | Creates example package configuration for Node.js CommonJS usage |
| examples/node-require/index.js | Provides example Node.js server using Rollbar with require() |
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 a new distribution intended specifically for Node applications that use
requireto integrate Rollbar instead ofimport.Related issues
https://rollbar.slack.com/archives/C07VAUL1954/p1754506445567739