Skip to content

Commit 276c0ec

Browse files
authored
chore: yjs & nextjs docs
1 parent 2842ff2 commit 276c0ec

File tree

1 file changed

+20
-0
lines changed
  • src/content/editor/getting-started/install

1 file changed

+20
-0
lines changed

Diff for: src/content/editor/getting-started/install/nextjs.mdx

+20
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,23 @@ export default function Home() {
7272
```
7373

7474
You should now see Tiptap in your browser. Time to give yourself a pat on the back! :)
75+
76+
### Using yjs with Next.js
77+
78+
To avoid the error: `Yjs was already imported. This breaks constructor checks and will lead to issues!`, add the following to your next.js config file. You might have to adjust the 'node_modules/yjs' to '../node_modules/yjs' or '../../node_modules/yjs' depending on where your node_modules are installed.
79+
80+
```js
81+
const path = require('path')
82+
83+
module.exports = {
84+
webpack: (config, { isServer }) => {
85+
if (!isServer) {
86+
// Ensure that all imports of 'yjs' resolve to the same instance
87+
config.resolve.alias['yjs'] = path.resolve(__dirname, 'node_modules/yjs')
88+
}
89+
return config
90+
},
91+
}
92+
```
93+
94+
The original discussion and fix can be found on [Github](https://github.com/yjs/yjs/issues/438#issuecomment-2225079409).

0 commit comments

Comments
 (0)