Skip to content

Commit

Permalink
chore: yjs & nextjs docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mwawrusch committed Jul 17, 2024
1 parent 2842ff2 commit 276c0ec
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/content/editor/getting-started/install/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,23 @@ export default function Home() {
```

You should now see Tiptap in your browser. Time to give yourself a pat on the back! :)

### Using yjs with Next.js

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.

```js
const path = require('path')

module.exports = {
webpack: (config, { isServer }) => {
if (!isServer) {
// Ensure that all imports of 'yjs' resolve to the same instance
config.resolve.alias['yjs'] = path.resolve(__dirname, 'node_modules/yjs')
}
return config
},
}
```

The original discussion and fix can be found on [Github](https://github.com/yjs/yjs/issues/438#issuecomment-2225079409).

0 comments on commit 276c0ec

Please sign in to comment.