-
Notifications
You must be signed in to change notification settings - Fork 759
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
request: discussion of webpack vs asset pipeline #813
Comments
It seems like, with asset pipeline, you would be dependent on gemified assets for things like thunk, whereas with webpacker you'd have access to npm... but I may not understand that well enough. |
Hi, @mustmodify, Good question. There will be tons of people out there using Sprockets as their asset pipeline and frankly I prefer Sprockets myself for small apps or when I'm starting out, then when a team of front end devs come onboard it gets swapped to Webpack, especially now it's won out over the alternatives like Browserify. What topics would you think would make a useful concise discussion point in an intro in the readme, I suspect Rails devs finding their way here will already have some awareness of JS ecosystem if they come seeking native React integration. Fun little note, I'd forked this gem a year ago and converted it to Gulp/Grunt + Browserify for it's pipeline before Webpacker was even a thing, turned into a total mess! Glad Webacker has the ecosystem behind it now and us Rails devs can keep being super productive. |
🍻 that's awesome! I'm glad to see a "blessed path" for Rails, too. |
Hi @BookOfGreg -- thanks for your generous response. You said:
I guess that's true. I have "some awareness" of it. But what I said about npm, for example, was a complete guess. So my principle question is "Assume I know not-very-much. How will this decision change my life in dev and in production?" Some thoughts:
|
That's a good series of points. Thanks for your time in making such a handy list. @mustmodify Do you reckon this would be well served by a wiki entry linked from the Readme or some other extra material? @rmosolgo Mind if I try reworking a lot of the docs around this, incorporating the points above as talking points in a wiki? Have any structural thoughts on it yourself? |
Wiki would be fine, though I would probably just put it in |
My principle question above could perhaps be better stated this way: "I use Rails. I like the asset pipeline. It provides all kind of production goodness. I'm at peace with adding js to my app because client-side code is good. But why would I consider going outside the asset pipeline? Not only that, but I'm moving only part of my assets outside it!" PS bonus points for figuring out how to get webpacker to work while files are at app/assets/javascript. :) |
The p.s isn't too hard :) config/webpack.yml default: &default
source_path: app/assets/javascript |
Won't you end up with webpack compiling the same assets as the asset pipeline? how will this work with |
Webpack will only compile things linked from the |
@mustmodify I've made a Wiki article here, not totally happy with it yet but it's a start. |
Good start! I started to write stuff, erased it, started to write again, erased it ... I'm not happy with my ideas for this. I'm getting that same feeling I have when code needs to be refactored. Let me think about it a bit. |
As for my experience, I found that its better to run production pre-compile locally rather than at server when using react-rails gem, as it will result into building fresh packages at the server and thus using high resource from CPU while building.. how would I prevent react-rails gem from participate with |
@BookOfGreg had documented the Webpack vs Sprockets here. Closing the issue. |
Help us help you! Please choose one:
react-rails
, so I've included the stack trace and the exact steps which make it crash.react-rails
with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.As someone who is trying to get started using this gem, I'm asking whether you would be willing to include a discussion of the tradoffs between using webpack and asset pipeline either in your readme or linked from there. I know I feel like that's a decision I'm making without understanding it, and I'm sure others do, too.
Thanks for your consideration.
The text was updated successfully, but these errors were encountered: