Skip to content

Commit ac73140

Browse files
committed
fix: exclude @blocknote/* from Vite optimizeDeps to prevent duplicate module loading
When Vite pre-bundles @liveblocks/react-blocknote, it inlines @blocknote/core, creating a second copy alongside the source-aliased version. This causes 'Duplicate use of selection JSON ID multiple-node' errors. Excluding @blocknote/* packages from optimizeDeps ensures they resolve through the dev aliases consistently.
1 parent 6c1c44a commit ac73140

5 files changed

Lines changed: 223 additions & 25 deletions

File tree

examples/07-collaboration/02-liveblocks/.bnexample.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"author": "yousefed",
55
"tags": ["Advanced", "Saving/Loading", "Collaboration"],
66
"dependencies": {
7-
"@liveblocks/client": "^3.17.0",
8-
"@liveblocks/react": "^3.17.0",
9-
"@liveblocks/react-blocknote": "^3.17.0",
10-
"@liveblocks/react-tiptap": "^3.17.0",
11-
"@liveblocks/react-ui": "^3.17.0",
7+
"@liveblocks/client": "^3.19.5",
8+
"@liveblocks/react": "^3.19.5",
9+
"@liveblocks/react-blocknote": "^3.19.5",
10+
"@liveblocks/react-tiptap": "^3.19.5",
11+
"@liveblocks/react-ui": "^3.19.5",
1212
"yjs": "^13.6.27"
1313
}
1414
}

examples/07-collaboration/02-liveblocks/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
"@blocknote/mantine": "latest",
1717
"@blocknote/react": "latest",
1818
"@blocknote/shadcn": "latest",
19+
"@liveblocks/client": "^3.19.5",
20+
"@liveblocks/react": "^3.19.5",
21+
"@liveblocks/react-blocknote": "^3.19.5",
22+
"@liveblocks/react-tiptap": "^3.19.5",
23+
"@liveblocks/react-ui": "^3.19.5",
1924
"@mantine/core": "^9.0.2",
2025
"@mantine/hooks": "^9.0.2",
2126
"react": "^19.2.3",
2227
"react-dom": "^19.2.3",
23-
"@liveblocks/client": "^3.17.0",
24-
"@liveblocks/react": "^3.17.0",
25-
"@liveblocks/react-blocknote": "^3.17.0",
26-
"@liveblocks/react-tiptap": "^3.17.0",
27-
"@liveblocks/react-ui": "^3.17.0",
2828
"yjs": "^13.6.27"
2929
},
3030
"devDependencies": {

playground/vite.config.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,24 @@ export default defineConfig(((conf: { command: string }) => ({
7171
},
7272
plugins: [react(), webpackStats(), Inspect(), tailwindcss()],
7373
optimizeDeps: {
74-
// link: ['vite-react-ts-components'],
74+
// Exclude @blocknote/* source-aliased packages from pre-bundling so that
75+
// when Vite pre-bundles @liveblocks/react-blocknote, it treats
76+
// @blocknote/* imports as external rather than inlining a second copy
77+
// (which would duplicate Selection.jsonID registrations like
78+
// "multiple-node").
79+
exclude: [
80+
"@blocknote/core",
81+
"@blocknote/react",
82+
"@blocknote/ariakit",
83+
"@blocknote/mantine",
84+
"@blocknote/shadcn",
85+
"@blocknote/xl-ai",
86+
"@blocknote/xl-multi-column",
87+
"@blocknote/xl-docx-exporter",
88+
"@blocknote/xl-odt-exporter",
89+
"@blocknote/xl-pdf-exporter",
90+
"@blocknote/xl-email-exporter",
91+
],
7592
},
7693
build: {
7794
sourcemap: true,

0 commit comments

Comments
 (0)