A guide for Webpacker?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

A guide for Webpacker?

Josh Goodall
Despite my protestations I'm seen as A Rails Expert within my organisation. And I've been fielding a ton of questions re. JS asset management, due to the switch to Webpacker.

Webpack is tremendously powerful and Webpacker is a helpful manager and wrapper. However, Webpack itself is also a Heath Robinson machine and trying to configure/debug it in many common cases immediately becomes a voyage into the arcane.

Neither of these Rails Guides currently make any mention of Webpack or Webpacker:
The Asset Pipeline - https://guides.rubyonrails.org/asset_pipeline.html
Working with JavaScript in Rails - https://guides.rubyonrails.org/working_with_javascript_in_rails.html

I don't think it's unreasonable to suggest that they should both deal with relevant aspects.

The 6.0 upgrade guide (https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#using-webpacker) makes it seem that an upgrade is as simple as adding a gem and running a task, but for many existing applications it will be very far from trivial.

None of this is meant to detract from what's already there - the Webpacker gem itself has many useful docs and a pretty good README, but they're mostly written from a different perspective to that of a _guide_.  In particular there's often assumption of familiarity with Webpack, and many docs are thorough references rather than introductory guides.

For all I know there may be a new guide in progress, but I couldn't see a PR or issue. It's something I'd be interested in at contributing to, if only for the selfish reason of reducing my own burden.


--
Josh

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/193994bf-321b-451e-b4bb-2a4f1d23771b%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: A guide for Webpacker?

Jake Niemiec
Hello Josh, I'm from the webpack side of the equation.

> It's something I'd be interested in at contributing to, if only for the selfish reason of reducing my own burden.

A PR would greatly be appreciated! Here are some off-the-cuff topics that I see coming up often on the issue tracker: 
  • "I already know what my webpack.js exports need to be, how do I convert that to webpackER?"
  • "Webpacker comes with node sass but I need to use dart sass"
  • ⭐️ How package.json (unintuitively) acts differently than a gemfile (and how it can ruin your day)
  • "I need to use webpack-dev-server to deploy my stuff" (don't do this)
  • ⭐️Misunderstandings about what should be in a "pack". Users who make every individual js file a new pack will find that every pack can come at an expediential cost performance/size/buildtime depending on how much library code is duplicated.  
  • How does json/data from server to packed js 
  • NODE_ENV vs RAILS_ENV
  • When to use a file.js.erb and when to use a filePack.js (and how those communicate with each other)
  • There are times where you need to ignore install instructions from JS library READMEs
Hope this is helpful for a potential guide. If you have any questions feel free to email.

On Tue, Aug 27, 2019 at 12:09 AM Josh Goodall <[hidden email]> wrote:
Despite my protestations I'm seen as A Rails Expert within my organisation. And I've been fielding a ton of questions re. JS asset management, due to the switch to Webpacker.

Webpack is tremendously powerful and Webpacker is a helpful manager and wrapper. However, Webpack itself is also a Heath Robinson machine and trying to configure/debug it in many common cases immediately becomes a voyage into the arcane.

Neither of these Rails Guides currently make any mention of Webpack or Webpacker:
The Asset Pipeline - https://guides.rubyonrails.org/asset_pipeline.html
Working with JavaScript in Rails - https://guides.rubyonrails.org/working_with_javascript_in_rails.html

I don't think it's unreasonable to suggest that they should both deal with relevant aspects.

The 6.0 upgrade guide (https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#using-webpacker) makes it seem that an upgrade is as simple as adding a gem and running a task, but for many existing applications it will be very far from trivial.

None of this is meant to detract from what's already there - the Webpacker gem itself has many useful docs and a pretty good README, but they're mostly written from a different perspective to that of a _guide_.  In particular there's often assumption of familiarity with Webpack, and many docs are thorough references rather than introductory guides.

For all I know there may be a new guide in progress, but I couldn't see a PR or issue. It's something I'd be interested in at contributing to, if only for the selfish reason of reducing my own burden.


--
Josh

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/193994bf-321b-451e-b4bb-2a4f1d23771b%40googlegroups.com.


--
WarmlyYours
Jake Niemiec
P: (800) 875-5285F: (800) 408-1100
Tell us how we're doing and receive $25 off your next order
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/CALn2xuCd7jkTegiO4V5Kp9ybDqUSZG55MQjBfK7%3DtCUy7AqO7g%40mail.gmail.com.