This course has been updated! We now recommend you take the Webpack 4 Fundamentals course.
Transcript from the "Audience Questions and Aphrodite" Lesson
>> Kent C Dodds: So Billy's asking about hash as a service worker. Those hashes are invalidated every time that, or are updated every time you rerun the build. So you run the build, the hashes get updated. The service worker gets updated as well and then when it gets loaded into the browser, that script is going to take this service record cache and remove anything that isn't in that list of assets in the service worker.
[00:00:37] And so, basically it just takes care of everything and then preloads all the new assets that it didn't have before and it loads those into the cache. So it'll work offline. And then Alberto asks, what's the advantage of creating a pre-deploy task instead of calling build and deploy.
[00:00:57] So you could totally do that. I like how npm scripts kind of compose together. It makes sense in my mind but yeah. I don't really see anything wrong with just doing like. You could totally just do, oops, npm run, build and deploy. Either way works. And then Danielle is asking, Kent, you mentioned you're using an alternative solution to DLLs/prefetch.
[00:01:29] Can you tell a little bit more? That different solution is the offline mode, so I don't need to prefetch modules. The idea behind the prevention module is you're on the login page, go fetch the rest of this stuff. This offline plugin is doing that for me. Because I get to the login screen, I get all the stuff that I need, and while I'm filling in the form, it's pre-fetching all my stuff.
[00:01:52] So I don't need the pre-fetch plugin when I'm using offline plugin. Although, if you do want to support browsers that don't support service worker, and you you don't want to use app cache, then the prefetch plugin could be useful in that scenario. But I don't have an example of that, sorry.
[00:02:14] So Scott is asking, what are the main reasons you have stopped using SAS in favor of actual CSS? So actually to be totally clear I don't actually use actual CSS, I don't use CSS files anymore. So this is just my opportunity to tell you about something that I love.
[00:02:32] It's Aphrodite, and no it's not a woman, I am married. No, it is a library for CSS and JS. And the cool thing about it is, so you're doing the CSS and JS that the React developers have come to love, and some other communities are starting to get into.
[00:02:53] But the cool thing about it is that it doesn't have the drawbacks of in line styles. Some of the drawbacks of in line styles, and by in line styling I mean a style you just put right here, foo is bar, whatever. Some of the drawbacks are if you have a long list and you put an inline style on every element in that list or even worse, a grid and inline styles in every cell of that grid and elements inside those cells, that's a performance drain big time.
[00:05:30] Those are functions, and sharing things from one file to another. Those are modules and so, once you start to think about it, it becomes really awesome. And I seriously diverted from the topic of webpack but this is something that I really love. So thanks for bearing with me.
[00:05:48] [LAUGH] So any other questions? We're pretty much, actually, looks like Oscar has a question. This service worker is minified, how do I get unminified to read it? I'm just guessing here, but I'm fairly certain that if you run the build without the dash-P flag, then it's not gonna minify anything.
[00:06:16] And I expect that you should be able to, or just nmp start. And we'll go to local host. And if we pop open Sources, Service. Actually, well, hold on. Just kidding, it looks like it's minified in here as well. So maybe you could go to the source code and look at what the service worker looks like there.
[00:06:49] Hold on a second, that looks incorrect. Actually, sorry one other thing that you need to do in here is fix the source maps in your webpack config,
>> Kent C Dodds: To use eval instead,
>> Kent C Dodds: And then we, oops, run the build and I would expect that it would be unminified and if it's not, then you can go ask an issues on that project.
[00:07:26] So if you go to a service worker. Yes, still minified. Sorry, I guess I just really care about minifying your stuff.