Use esm syntax for replay defaults and related maintenance#1176
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors several files to adopt ES module syntax from CommonJS, improving consistency and modernizing the codebase. Key changes include:
- Converting default exports in the browser defaults file to ES module exports.
- Rewriting fixture files to use named exports and removing redundant export statements.
- Removing the CommonJS module.exports block in the types definitions file.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/browser/replay/defaults.js | Converted module.exports to export default for the default options object. |
| test/fixtures/replay/rrwebSyntheticEvents.fixtures.js | Changed syntheticEvents to export const and removed redundant export statement. |
| test/fixtures/replay/rrwebEvents.fixtures.js | Changed rrwebEvents to export const and removed redundant export statement. |
| test/fixtures/replay/types.js | Removed the module.exports block in favor of individual exports. |
waltjones
approved these changes
Apr 28, 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
Description by Copilot.
This pull request refactors the module export structure across several files to adopt ES module syntax (
export/import) instead of CommonJS (module.exports). The changes improve consistency, readability, and alignment with modern JavaScript standards.Refactoring to ES module syntax:
src/browser/replay/defaults.js: Replacedmodule.exportswithexport defaultfor the default options object.test/fixtures/replay/rrwebEvents.fixtures.js: ConvertedrrwebEventsfrom a CommonJS export to an ES module export usingexport const. Removed the redundantexport { rrwebEvents };statement. [1] [2]test/fixtures/replay/rrwebSyntheticEvents.fixtures.js: UpdatedsyntheticEventsto useexport constand removed the redundantexport { syntheticEvents };statement. [1] [2]test/fixtures/replay/types.js: Removed themodule.exportsblock entirely, as individual exports (export const) are already defined for each type.Type of change
Related issues
Checklists
Development