Ruby Rogues

RR 434: Surviving Webpack with Ross Kaffenberger


Listen Later

Ross Kaffenberger is a software engineer at Stitch Fix and has been developing web applications for the past 12 years, mostly in Ruby and JavaScript. Today he and the panel are discussing how to survive Webpack. When many folks first encounter Webpack, they feel confused, overwhelmed, and don’t know how to get it to do what you want it to. In the latest version they tried to introduce some more sane default settings, but it is still a major change in technology. Ross talks about how his company transitioned Rails 5 to Rails 6 with the new Webpacker. His company chose to take an iterative approach and slowly migrated to Webpacker. His app was very JS heavy with a large number of libraries, many of which were not very Webpack friendly. They chose to separate out the vendor libraries into a separate bundle, that way they could contain each deploy. They still had to add some configuration, especially to make things available on global scope.As they started moving jQuery plugins over, sometimes the functionality would disappear, and Ross talks about how they figured out their mistakes. It was difficult for them to get out of their Sprockets mindset and into the new mindset of Webpack, which requires different techniques. There are also things that Webpack can do to keep you out of that situationRoss gives some strategy advice for someone who is in a position to update from Sprockets to Webpack. It’s important to consider your app size, your comfort level with Webpack, your team dynamic, and your timeframe. Ross recommends the iterative approach that they took, which took longer, but allowed them to learn as they went. Ross talks about the changes that happened in the switch from Webpack 3 to Webpack 4, and some of the contributions they made. He talks about some of his preferred Webpack configs and plugins. They discuss some of the drawbacks of Webpack, particularly the plethora of plugins that can make it seem daunting. One of the big gotchas with Webpack is the location of your source code. When you install Webpack for the first time, create a JS folder under App, it will place a ‘application.js’ file in another file called ‘Packs”. The idea of that pack file (application.js file under Packs) is that it’s the entry point for all of the JS that you’re going to add to your Webpack build. But if you add additional files to that Pack folder, Webpacker will instruct Webpack to treat each of those files as a separate entry point in a dependency graph. Make sure that only files that are intended to be the entry points for your Webpack builds are in that packs folder. It is also important to understand how you’re using global scope inside your JavaScript modules in your build. There’s a way to allow Webpack to inspect each of the files for a certain variable, such as a dollar sign. If he could go back and do it again, Ross would not split his code manually, but instead Embrace the notion that Webpack understands how to do code splitting for you, as long as instruct it to do it the right way.Ultimately, it took Ross’ company 3 rather tedious months to transition to Webpack. It could’ve gone faster if they’d known more about Webpack to begin with. The panel discusses whether it was worth it to switch to Webpack. Transitioning to Webpack has changed their team dynamic and their day to day coding and debugging. One nice feature of Webpack is the source maps that aid in debugging. There are still areas for improvement, but now that it’s set up most folks on the team don’t think about it. Overall, the development experience has improved, and he thinks it was worth it, but it’s not for everybody.Panelists
  • Dave Kimura
  • Andrew Mason
  • Nate Hopkins
  • Charles Max Wood
With special guest: Ross KaffenbergerSponsors
  • Sentry use the code “devchat” for 2 months free on Sentry’s small plan
  • Cloud 66 - Pain Free Rails Deployments Try Cloud 66 Rails for FREE & get $66 free credits with promo code RubyRogues
  • Views on Vue
Links
  • Webpack
  • Webpacker
  • Sprockets 
  • Knockout.js
  • CKEditor
  • Chosen
  • Webpack Bundle Analyzer
  • Manifest.json
  • Module shimming
  • SplitChunksPlugin
  • Vue
Follow DevChatTV on Facebook and Twitter PicksDave Kimura:
  • Avengers Quinjet Lego set
  • Portable air conditioner
Nate Hopkins:
  • MDN JavaScript Reference
  • Brandon Sanderson’s Mistborn series 
Charles Max Wood:
  • Restream
  • Twitch
  • OBS
Ross Kaffenberger: 
  • Exploring ES6
  • 1 Second Everyday
  • One Sentence Journal
Follow Ross on Twitter and Github, and on his blog Special Guest: Ross Kaffenberger.

Advertising Inquiries: https://redcircle.com/brands

Privacy & Opt-Out: https://redcircle.com/privacy

Become a supporter of this podcast: https://www.spreaker.com/podcast/ruby-rogues--6102073/support.
...more
View all episodesView all episodes
Download on the App Store

Ruby RoguesBy Charles M Wood

  • 3.4
  • 3.4
  • 3.4
  • 3.4
  • 3.4

3.4

21 ratings


More shows like Ruby Rogues

View all
MacBreak Weekly (Audio) by TWiT

MacBreak Weekly (Audio)

2,012 Listeners

The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

286 Listeners

JavaScript Jabber by Charles M Wood

JavaScript Jabber

232 Listeners

Accidental Tech Podcast by Marco Arment, Casey Liss, John Siracusa

Accidental Tech Podcast

2,095 Listeners

iPhreaks by Charles M Wood

iPhreaks

17 Listeners

Ruby Rogues by Charles M Wood

Ruby Rogues

45 Listeners

The Freelancers' Show by Charles M Wood

The Freelancers' Show

23 Listeners

The Ruby on Rails Podcast by Elise Shaffer

The Ruby on Rails Podcast

53 Listeners

Adventures in Angular by Charles M Wood

Adventures in Angular

33 Listeners

The Bike Shed by thoughtbot

The Bike Shed

121 Listeners

Software Engineering Daily by Software Engineering Daily

Software Engineering Daily

630 Listeners

React Native Radio by Jamon Holmgren, Robin Heinze, Mazen Chami

React Native Radio

57 Listeners

Soft Skills Engineering by Jamison Dance and Dave Smith

Soft Skills Engineering

272 Listeners

My JavaScript Story by Charles M Wood

My JavaScript Story

4 Listeners

JavaScript Jabber by Charles M Wood

JavaScript Jabber

61 Listeners

Adventures in Angular by Charles M Wood

Adventures in Angular

15 Listeners

Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

Syntax - Tasty Web Development Treats

986 Listeners

REWORK by 37signals

REWORK

210 Listeners

CoRecursive: Coding Stories by Adam Gordon Bell - Software Developer

CoRecursive: Coding Stories

185 Listeners

Remote Ruby by Chris Oliver, Andrew Mason

Remote Ruby

34 Listeners

The Stack Overflow Podcast by The Stack Overflow Podcast

The Stack Overflow Podcast

63 Listeners

IndieRails by Jess Brown & Jeremy Smith

IndieRails

5 Listeners

Latent Space: The AI Engineer Podcast by swyx + Alessio

Latent Space: The AI Engineer Podcast

63 Listeners

The Rails Changelog by Emmanuel Hayford

The Rails Changelog

5 Listeners