-
Notifications
You must be signed in to change notification settings - Fork 73
Browserify compatibility #183
Comments
I've digged a bit, and it doesn't seem too complicated:
|
I've updated my local copies of package.json to fix the issues mentioned above, and the tests apparently completed without issues (actually, some tests failed, but they also fail on a fresh clone 😞). Would you accept a PR on each affected package with the changes discussed above? |
I would be interested to see what you have achieved, so even if not in a PR could you share your modifications? |
@positive07 The steps highlighted above have been the only changes required to make text-buffer work in a browser environment. It was a proof-of-concept, and I haven't yet been able to actually use it in a real-world application, but it sounds promising. |
Ping @maxbrunsfeld? 😃 |
We are interested in being able to use this module in a browser. Our preferred approach would be to use emscripten to compile the native modules to asm.js or webassembly, rather than maintaining JS ports of our native code. We don't know how hard this will be, though; it's not something we've ever tried. |
Hm, it would require a bit more work, since that would require to move the business logic from |
@arcanis All of the non-trivial logic in those modules is already in separate C++ files that don't use V8. So we'd just need to write an additional binding, using the browser APIs. |
I've started to experiment in this direction, starting with buffer-offset-index. Major changes are:
I haven't yet been able to test that the generated asm.js file actually works, but it compiles without issue, and it's a selling point of nbind, so I'm not overly worried. I'm going to try to apply the same changes to Feel free to let me know what you think about this. |
/cc @bolinfest |
There's a small compatibility issue with using nbind: it doesn't yet implement automatic conversion from and to Related issue: charto/nbind#37 |
There's also something weird going on with the asm.js build. I've improved the tests in my fork so that they are deterministic (by using a constant seed) and run on both builds, native & asm.js alike, but the asm.js tests are currently failing after 145,000 successful iterations. I have no idea what can go wrong, if it's because of nbind or Emscripten itself ... :( |
The error was due to a specific option that was set during the emscripten compilation ( I've opened a PR on |
It would be interesting to be able to run Text-Buffer in browser environments. Unfortunately, it looks impossible right now, because multiple of its dependencies actually use native node modules, and don't offer js fallbacks (even inefficient fallbacks would be fine, really).
The text was updated successfully, but these errors were encountered: