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

Expose bundles to Sprockets #91

Closed
perezperret opened this issue Feb 9, 2017 · 3 comments
Closed

Expose bundles to Sprockets #91

perezperret opened this issue Feb 9, 2017 · 3 comments

Comments

@perezperret
Copy link

I don't know the correct way to go about this, but I need to load a bundled file through sprockets for a gem to use it (react-rails). Basically, I expose a module globally in a pack (using webpack's library output option) and I need to point react-rails to this bundle to pre-render some stuff with ExecJS, but react-rails loads js through sprockets, right now if I manually add the pack to the assets path in the assets initialisers, I can get the server-side renderer to load it through sprockets, but it doesn't detect changes to it, which causes the server rendered version to be out of sync with the client side version (which loads the bundle with the javascript_pack helper). I can only assume this is going to be an even bigger problem in production. What I guess I need is an interface for sprockets to load these bundles, does that make sense as part of this gem?

For reference, have a look at the repo I'm working on, it is thoroughly explained in the README.

@gauravtiwari
Copy link
Member

@perezperret You may want to use https://github.com/renchap/webpacker-react, drop-in replacement for react-rails and works with webpacker.

Feel free to close this one if it's okay 👍

@justin808
Copy link
Contributor

@perezperret We'll soon have Webpacker integration completed: shakacode/react_on_rails#811

@gauravtiwari
Copy link
Member

Update: Also react-rails now provides first-class support for Webpacker - https://github.com/reactjs/react-rails#use-with-webpacker

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

No branches or pull requests

5 participants