question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

request: discussion of webpack vs asset pipeline

See original GitHub issue

Help us help you! Please choose one:

  • My app crashes with react-rails, so I’ve included the stack trace and the exact steps which make it crash.
  • My app doesn’t crash, but I’m getting unexpected behavior. So, I’ve described the unexpected behavior and suggested a new behavior.
  • I’m trying to use 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.
  • I have another issue to discuss.

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
mustmodifycommented, Oct 24, 2017

Hi @BookOfGreg – thanks for your generous response.

You said:

I suspect Rails devs finding their way here will already have some awareness of JS ecosystem if they come seeking native React integration.

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:

  • The thing I mentioned about NPM vs gems.
  • I believe that webpack and sprockets both concatenate all js files into one… if that’s true, I would say that. And I assume it also does minification and compression?
  • Will webpacker do fingerprints like asset pipeline?
  • But WebPacker isn’t what turns ES6 code into “acceptable” javascript, right? That’s another tool often bundled with it… So is that available either way?
  • Will I need to commit a webpacker asset file to the repo? Or will it be generated during precompile? If so, is that handled for me, or do I need to add something to capistrano / etc?
  • With the react_on_rails gem I needed to have a separate process watching webpacker. But I don’t need that for the asset pipeline. Is that true here? How should I set that up?
2reactions
mustmodifycommented, Oct 25, 2017

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. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack VS Sprockets - The Lean Software Boutique
Asset Pipeline is the term used by Rails to refer to the use of Sprockets-Rails to handle assets. There are more solutions for...
Read more >
From the Asset Pipeline to Webpack | michelada.io - Medium
This command sets up Rails to use Webpack. If you need something like React, Angular, Elm, or Vuejs set up then you can...
Read more >
From the Asset Pipeline to Webpack
With Webpack in place, you can start moving your assets from the Asset Pipeline folders to the new app/javascript folder. Let us start...
Read more >
Separating webpack from the Rails Asset Pipeline
Before the Asset Pipeline can begin, webpack must do all it's processing and have completed. Furthermore, the Asset Pipeline is re-loading and ...
Read more >
Rails with Webpack - Why and How | reinteractive blog
To use Webpack with Rails what we need to do is simply forget about the Asset Pipeline and manage all our front-end using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found