dmonad/lib0

Usage with webpack

aulneau opened this issue · 2 comments

Hi there!

I am starting to use yjs, and ran into an issue with this library not being correctly used/transpiled by the bundling I'm using. The app is a next.js application, which uses webpack etc to bundle everything. I am trying to run the yjs function applyUpdate, which seems to have a dep somewhere on the binary lib in lib0.

This is the error I get:

TypeError: contentRefs[(info & lib0_binary_js__WEBPACK_IMPORTED_MODULE_17__.BITS5)] is not a function

Also when I have tried to import other libraries from lib0, I get similar errors.

Thanks so much!

Hi @aulneau , can you please check what the value of lib0_binary_js__WEBPACK_IMPORTED_MODULE_17__.BITS5 is?

Also, what is the difference to https://github.com/yjs/yjs-demos ? All demos there use webpack as a bundler and it seems to work.

@dmonad I think I figured out the issue. I was encoding my arrays incorrectly and passing them through, and when the contentRefs[(info & lib0_binary_js__WEBPACK_IMPORTED_MODULE_17__.BITS5)] tried to find the function for reading it, it failed. I'm going to close this. Thanks so much for all your work!