The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

kevinl (37) [Avatar] Offline
In a book that'll talk about HTTP/2 in length in the context of Web optimization, a chapter about modular JavaScript specifically w/ RequireJS seems really odd to me considering the alternatives that actually leverage HTTP/2 and where HTTP protocol is going.

- <script type="module"></script> provided by modern browsers to load modular JS written in ES6
- SystemJS which has optimized affordances to HTTP/2 (depcache) & etc
- Webpack 2 that also leverages SystemJS within it for JIT loading of modular JS written in ES6.

Also in general it seems like an eccentric idea:

- Too specific; if a reader has no plans to use requireJS because of its limitations today, they're SOL on how to be more performant about modular JS; this seems like a chapter that'll need to address either multiple approaches or a canonical native approach via <script type="module">

Overall, I think for all potential readers of this book that the chapter is reconsidered that'll lead to RequireJS not being to much a priority or requirement to learn more about writing more performant modular JavaScript.
Jeremy Wagner (15) [Avatar] Offline
Hi, Kevin.

First off, I want to thank you for being the first person to post a topic on this book. I hope that the book is otherwise useful to you so far, and even if you haven't purchased the MEAP, your topic is still an excellent contribution to this book and I'm happy to read it.

The reality is that this chapter subject is a holdover from when the book was first proposed. I do like a lot of things that RequireJS does to help make dependencies easier to manage when <script async> is used. I really like where its successor Alameda is going, and I do cover a bit of that in Chapter 8, but not exhaustively so.

That said, I agree with you whole heartedly, and I'm glad you brought it up. Chapter 9 will not be about RequireJS. Its contents are still being decided, but I'm leaning toward a mixture of things, such as the battery API, Service Workers and some of what you're talking about with ES6 modules.

So fear not, the topic of chapter 9 will be much more forward thinking than where it stands on the MEAP page now. When the next MEAP chapter is released for chapter 4, I will ensure that the copy writers update the chapter listing, because I would hate to see people walk away from this book because of a holdover topic I no longer intend to write on.

kevinl (37) [Avatar] Offline
Understood, Wagner:

Thanks for clarifying this; it's awesome to hear Service Workers will be covered.

Maybe perhaps even Web Components since that also makes a common Web application need, widgets, a whole lot more performant?
Jeremy Wagner (15) [Avatar] Offline
I worry about the status of web components, three parts of it (Shadow DOM, Custom Elements and HTML Imports) are still in the working draft phase. For that matter, so is the Service Workers feature, so chapter 9 content is still under consideration yet. Web Workers has much better support, and it's past the draft phase, and that may be a more suitable topic to cover since it's a well developed feature that can have positive effects on performance. That said, I would love to be able to cover Service Workers, because I had high hopes of covering the Application Cache feature, but that became deprecated.

As you can imagine, one fear of being an author is covering a nascent feature and having its functionality change significantly just after a book goes to print. Obsolescence is a continual threat when writing books for print, so I'm trying to balance things as best as possible between things that are cutting edge, what readers are interested in, and what will comprise a book of usable information when the book is released. If a book doesn't get a second edition, the content never gets a chance to be updated again.

I have every confidence that no matter what, chapter 9 will have a lot of great content to choose from. If you bought the MEAP, I think you're going to be pretty happy with the end product. Mostly because I'll have people like you to keep me on my toes with your feedback and insight.
kevinl (37) [Avatar] Offline
Regarding Web Components, I definitely don't expect they'll be much content about it; but Browser Vendors have reached consensus on v1 of Shadow DOM and Custom Elements. Your concern is well warranted and it being touched upon deeply in this book would be eccentric (if wanted to be talked about more than its context in the book, it'll at best be an appendix).

You'd probably at most show them something along the lines of this demonstration of HTTP/2 push promises and components loaded on the page using it that are Web Components:

Apple, Webkit, & Google have already shipped their v1 compliant versions of both (Safari Technology Preview is behind on importing Webkit's implementation as far as custom elements but no longer have reservations) while Mozilla's and Microsoft's are in progress.

HTML Imports however is on hold till browser vendors have reached consensus on a couple of things associated with something that's more urgent to be settled that'll ultimately impact how it's implemented as well that Mozilla pointed out: How ES6 modules will be loaded by browsers in general.

From there, the fate of HTML Imports would then be rediscussed for a V1 version (the version all browsers implemented beyond the v0 version that currently runs in Blink browsers) beyond the simple polyfill Web Component libraries such as Polymer leverage.

Accordingly, one of the things that has resulted in that being dealt with is <script type="module"> to handle ES6 modules.

With that settled, it resulted in v1 of the HTML Import called HTML Modules that plays along with <script type="module">:

When it comes to Service Workers, along with things like requestIdleCallback & createImageBitmap, would be awesome to be featured in this upcoming book