Skip to content

Conversation

@Shreyas281299
Copy link
Contributor

@Shreyas281299 Shreyas281299 commented Jul 2, 2025

COMPLETES # Adhoc

This pull request addresses

  • For exposing webex we are using export in package.json, for this we are use modeuleResolution as NodeNext, in this the export needs to have the types path otherwise we are unable to refer the types in widgets

by making the following changes

  • When we use ESM module resolution

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

Screenshot 2025-07-02 at 6 09 02 PM

After
Screenshot 2025-07-02 at 6 08 32 PM

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@Shreyas281299 Shreyas281299 requested a review from a team as a code owner July 2, 2025 12:32
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 2, 2025

📝 Walkthrough

Walkthrough

The change updates the exports field in the package.json file of the @webex/plugin-cc package. The previous configuration, which mapped the main export to a single JavaScript file, is replaced with an object specifying separate "import", "require", and "types" entries. This explicitly defines the JavaScript entry points for ES modules and CommonJS, as well as the TypeScript type declarations. The export for "./package" remains unchanged. No code or public API changes are involved; only the package manifest is updated.

Possibly related PRs


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea2e5fe and 0a47a18.

📒 Files selected for processing (1)
  • packages/@webex/plugin-cc/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/@webex/plugin-cc/package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Initialize Project

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Shreyas281299 Shreyas281299 added the validated If the pull request is validated for automation. label Jul 2, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8e35ff and ea2e5fe.

📒 Files selected for processing (1)
  • packages/@webex/plugin-cc/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: robstax
PR: webex/webex-js-sdk#3948
File: packages/@webex/webex-core/test/unit/spec/webex-core.js:178-254
Timestamp: 2024-11-01T00:30:53.442Z
Learning: In the webex-js-sdk project, when reviewing changes in `packages/@webex/webex-core/test/unit/spec/webex-core.js`, if the user declines to add negative test cases for invalid interceptor configurations, accept their decision and do not insist.
Learnt from: Kesari3008
PR: webex/webex-js-sdk#4258
File: packages/@webex/plugin-cc/src/webex.js:0-0
Timestamp: 2025-05-13T17:01:05.340Z
Learning: In the webex-js-sdk project, `PACKAGE_VERSION` is a constant that's injected by the build system and doesn't need to be explicitly imported in the source files.
Learnt from: pagour98
PR: webex/webex-js-sdk#4086
File: packages/@webex/plugin-cc/test/unit/spec/services/task/dialer.ts:52-57
Timestamp: 2025-02-12T10:13:06.265Z
Learning: In packages/@webex/plugin-cc tests, catch blocks in test cases follow CC Desktop pattern using `expect(true).toBe(true)` for consistency.
packages/@webex/plugin-cc/package.json (3)
Learnt from: Kesari3008
PR: webex/webex-js-sdk#4258
File: packages/@webex/plugin-cc/src/webex.js:0-0
Timestamp: 2025-05-13T17:01:05.340Z
Learning: In the webex-js-sdk project, `PACKAGE_VERSION` is a constant that's injected by the build system and doesn't need to be explicitly imported in the source files.
Learnt from: pagour98
PR: webex/webex-js-sdk#4086
File: packages/@webex/plugin-cc/test/unit/spec/services/task/dialer.ts:52-57
Timestamp: 2025-02-12T10:13:06.265Z
Learning: In packages/@webex/plugin-cc tests, catch blocks in test cases follow CC Desktop pattern using `expect(true).toBe(true)` for consistency.
Learnt from: robstax
PR: webex/webex-js-sdk#3948
File: packages/@webex/webex-core/test/unit/spec/webex-core.js:178-254
Timestamp: 2024-11-01T00:30:53.442Z
Learning: In the webex-js-sdk project, when reviewing changes in `packages/@webex/webex-core/test/unit/spec/webex-core.js`, if the user declines to add negative test cases for invalid interceptor configurations, accept their decision and do not insist.
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Initialize Project
  • GitHub Check: AWS Amplify Console Web Preview

Comment on lines 18 to 21
".": {
"import": "./dist/webex.js",
"types": "./dist/types/index.d.ts"
},
Copy link
Contributor

@coderabbitai coderabbitai bot Jul 2, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

CommonJS require() will throw – add require/default conditions

Node’s resolution algorithm ignores the top-level main field once an exports map is present.
Because the new map only exposes the "import" condition, a consumer that does
require('@webex/plugin-cc') will now receive

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath '.' is not defined …

Add a require (or at least default) condition that points to the same built file, or publish a dedicated .cjs build if you ship dual bundles.

   ".": {
     "import": "./dist/webex.js",
+    "require": "./dist/webex.js",
+    "default": "./dist/webex.js",
     "types": "./dist/types/index.d.ts"
   },

Failing to do so is a breaking change for every CommonJS consumer of plugin-cc.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
".": {
"import": "./dist/webex.js",
"types": "./dist/types/index.d.ts"
},
".": {
"import": "./dist/webex.js",
"require": "./dist/webex.js",
"default": "./dist/webex.js",
"types": "./dist/types/index.d.ts"
},
🤖 Prompt for AI Agents
In packages/@webex/plugin-cc/package.json around lines 18 to 21, the exports map
only includes the "import" condition, causing CommonJS require() calls to fail
with a package path not exported error. To fix this, add a "require" condition
(or at least a "default" condition) alongside "import" in the exports map that
points to the same built file (e.g., "./dist/webex.js") so CommonJS consumers
can resolve the package correctly without errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added require.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Shreyas281299 Perfect! Thank you for adding the require condition to the exports map. This ensures that both ES module imports and CommonJS require() calls will work correctly, preventing the "Package subpath '.' is not defined" error for CommonJS consumers.

The fix maintains backward compatibility while properly exposing the TypeScript types. 🎉


🧠 Learnings used
Learnt from: Kesari3008
PR: webex/webex-js-sdk#4258
File: packages/@webex/plugin-cc/src/webex.js:0-0
Timestamp: 2025-05-13T17:01:05.340Z
Learning: In the webex-js-sdk project, `PACKAGE_VERSION` is a constant that's injected by the build system and doesn't need to be explicitly imported in the source files.

Learnt from: pagour98
PR: webex/webex-js-sdk#4086
File: packages/@webex/plugin-cc/test/unit/spec/services/task/dialer.ts:52-57
Timestamp: 2025-02-12T10:13:06.265Z
Learning: In packages/@webex/plugin-cc tests, catch blocks in test cases follow CC Desktop pattern using `expect(true).toBe(true)` for consistency.

Learnt from: robstax
PR: webex/webex-js-sdk#3948
File: packages/@webex/webex-core/test/unit/spec/webex-core.js:178-254
Timestamp: 2024-11-01T00:30:53.442Z
Learning: In the webex-js-sdk project, when reviewing changes in `packages/@webex/webex-core/test/unit/spec/webex-core.js`, if the user declines to add negative test cases for invalid interceptor configurations, accept their decision and do not insist.

If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

Copy link
Contributor

@adhmenon adhmenon left a comment

Choose a reason for hiding this comment

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

Let's also see if the coderabbit suggestion is valid

@Shreyas281299 Shreyas281299 enabled auto-merge (squash) July 2, 2025 12:41
@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4376.d3m3l2kee0btzx.amplifyapp.com

@Shreyas281299 Shreyas281299 disabled auto-merge July 2, 2025 12:45
@Shreyas281299 Shreyas281299 enabled auto-merge (squash) July 2, 2025 16:02
@Shreyas281299 Shreyas281299 merged commit bbbf152 into webex:next Jul 2, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants