Hi -
Hearing all the good things about yjs especially its performance, I tried to work on a simple sample to test yjs out, only quickly (and sadly) running into the problem when compiling the sample codes
import * as Y from 'yjs';
import { IndexeddbPersistence } from 'y-indexeddb';
const ydoc = new Y.Doc();
// this allows you to instantly get the (cached) documents data
const indexeddbProvider = new IndexeddbPersistence('count-demo', ydoc);
indexeddbProvider.whenSynced.then(() => {
console.log('loaded data from indexed db');
});
// array of numbers which produce a sum
const yarray = ydoc.getArray('count');
// observe changes of the sum
yarray.observe(event => {
// print updates when the data changes
console.log(`new sum: ${yarray.toArray().reduce((a, b) => a + b)}`);
});
// add 1 to the sum
yarray.push([1]); // => "new sum: 1"
And the problem lies in the compiling stage shown in the below. Please help. Thanks!
Circular dependency: node_modules/lib0/encoding.js β node_modules/lib0/buffer.js β node_modules/lib0/encoding.js
Circular dependency: node_modules/lib0/buffer.js β node_modules/lib0/decoding.js β node_modules/lib0/buffer.js
Circular dependency: node_modules/lib0/encoding.js β node_modules/lib0/buffer.js β node_modules/lib0/encoding.js
Circular dependency: node_modules/lib0/buffer.js β node_modules/lib0/decoding.js β node_modules/lib0/buffer.js