Closed sammacbeth closed 4 years ago
Similarly to y-protocols, this is also a esm module that works in nodejs >= v13. Similarly to your ticket here https://github.com/yjs/y-protocols/issues/3 cjs modules should import the lib0/dist/[X].cjs file instead of lib0/[X].js. In my projects I simply overwrite the import path (see rollup.config.js) when I transform a module to cjs.
Furthermore, the index.js export is not yet fully supported. Some of the modules have side effects that force bundlers to include unnecessary functions. My recommendation for now (and probably also for the future) is to import the module files directly.
This fixes module imports on node, making
require('lib0')
work correctly.