Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with import maps #55

Open
slondr opened this issue Jun 23, 2023 · 2 comments
Open

Compatibility with import maps #55

slondr opened this issue Jun 23, 2023 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@slondr
Copy link

slondr commented Jun 23, 2023

I'm looking into using yrb-actioncable with my rails app, but am blocked on the requirement to use yarn… Is there a way to use this project with import maps, which is the standard way to load JavaScript in a rails app since 7.0?

@eliias eliias added the documentation Improvements or additions to documentation label Jun 24, 2023
@eliias eliias self-assigned this Jun 24, 2023
@eliias
Copy link
Collaborator

eliias commented Jun 24, 2023

There shouldn't be a hard blocker using this package itself with import maps, but the dependencies are a problem. In other words, yjs could be a bit tricky to get right.

There are three dependencies, you could try adding them to the import map and run the bare minimum example app.

  • yjs The client-side CRDT library (This might be hard to get right)
  • @y-rb/actioncable The Websocket bridge for CRDTs (this URL should work for the import map https://ga.jspm.io/npm:@y-rb/[email protected]/dist/index.js)
  • @rails/actioncable for Rails Actioncable (I think Rails supports that out of the box already)

I can try to find some time setting up a Rails demo app with import maps as well, but if you already have something, happily taking PRs.

@Phaengris
Copy link

In case anyone else will find this thread.

This is how I made it work in my Rails app.

https://phaengris.art/stories/2024-02-21_how-to-use-yjs-in-rails-with-importmap/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants