-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WEB-2168] fix: yjs duplicate import error #5297
Conversation
Important Review skippedAuto reviews are limited to specific labels. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes enhance a Next.js application's configuration by introducing a custom Webpack function that sets up an alias for the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Webpack
participant Yjs
Client->>Webpack: Start Build
Webpack->>Yjs: Resolve Module
Yjs-->>Webpack: Return Module Instance
Webpack-->>Client: Build Complete
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- web/next.config.js (2 hunks)
Additional comments not posted (2)
web/next.config.js (2)
4-4
: LGTM!The import statement for the
path
module is necessary for aliasing theyjs
module in the Webpack configuration.
39-44
: LGTM! But verify the Webpack function's correctness.The custom Webpack function correctly aliases the
yjs
module to ensure consistent module resolution in client-side builds.However, ensure that the aliasing works as expected and does not introduce any issues in the build process.
Verification successful
Let's re-verify the Webpack aliasing for 'yjs' by searching for the alias configuration in the Webpack config more thoroughly.
Let's correct the syntax error and re-run the script to verify the Webpack aliasing for 'yjs'.
Let's re-verify the Webpack aliasing for 'yjs' by searching for the alias configuration in the Webpack config more thoroughly.
Let's re-verify the Webpack aliasing for 'yjs' by searching for the alias configuration in the Webpack config with a more straightforward pattern.
Webpack alias for 'yjs' is correctly configured.
The alias configuration for 'yjs' was found in the
next.config.js
file, ensuring that all imports of 'yjs' resolve to the same instance in client-side builds.
config.resolve.alias["yjs"] = path.resolve(__dirname, "node_modules/yjs");
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the Webpack aliasing for 'yjs' works as expected. # Test: Check for the alias configuration in the Webpack config. Expect: Alias for 'yjs' should be present. rg --type js -A 5 $'alias[\'"]yjs[\'"]'Length of output: 44
Script:
#!/bin/bash # Description: Verify that the Webpack aliasing for 'yjs' works as expected. # Find the next.config.js file and check for the alias configuration. fd next.config.js --exec rg 'alias[\'"]yjs[\'"]' {}Length of output: 93
Script:
#!/bin/bash # Description: Verify that the Webpack aliasing for 'yjs' works as expected. # Find the next.config.js file and check for the alias configuration. fd next.config.js --exec rg "alias['\"]yjs['\"]" {}Length of output: 59
Script:
#!/bin/bash # Description: Verify that the Webpack aliasing for 'yjs' works as expected. # Find the next.config.js file and check for the alias configuration. fd next.config.js --exec rg 'alias["'\'']yjs["'\'']' {}Length of output: 59
Script:
#!/bin/bash # Description: Verify that the Webpack aliasing for 'yjs' works as expected. # Find the next.config.js file and check for the alias configuration. fd next.config.js --exec rg 'alias.*yjs' {}Length of output: 128
This PR fixes the issue of duplicate Yjs import.
Reference- https://tiptap.dev/docs/editor/getting-started/install/nextjs#using-yjs-with-nextjs
Plane issue: WEB-2168
Summary by CodeRabbit
New Features
yjs
library.Bug Fixes