I mean, youknowtheway, umthat I hopeyouhave a waytoseeifthewayit's alwaysgiveaway.
Allright?
Right, right.
Right.
Yeah, wegotthink.
Good.
Presspress.
Thefirstthingisthething, right?
Okay.
Wecouldgothefullscreen f forfullscreen.
Therewego.
Yeah.
Oh, okay.
Right.
Ah.
Soearlierthisyear, a fewofuswenton a factfindingmissiontoIndiatoseehowfolkswhousedtheInternetoutthereandonethingstoodouttous, andthatisthatfeaturephonesareback.
Yes, andalsothegeophoneontheendThere, thisis a webbasedphoneisrunningChiyo s, whichis a forkoftheoldFirefoxos.
SothisphoneiskindofisrunningFirefox 42 forprettymucheverything s o a littleteamofusgottogetherconsistingoffsummerJakeonDheAmericoshesheshe's inAmericamightmarketinAmerica.
So, asidefrombeing a bitslow, itwasn't reallyallthatdifferentfromyouraverageeverydayJavascriptof a nap.
Yeah, Soaction.
I wasprettybasic, right?
Youcontend?
Littlebitofmetadata.
Jarvis, wefilethattookcareofpopulatingthepage.
We'vegotstylesheetthere.
Thatstarsheisjustfor a webfront.
TherestofourCSSwasembeddedinourjobscriptbypost.
Yes, thenotabledifferencefrommostweapons, I think, isthatweusedpreactinsteadofreact.
Reactis 33 daypreactisthreecakeReactcandomuchmore, butnoneofthethingsthat I candomoreweactuallyneeded.
Forus, itwasreallylike a nobrainertobeabletosave 30 casestraightoutstarted.
Yes, absolutely.
Theotherdifferencesweusedrollupbasicallybecausewewantedtogiveit a trylikewe'd userollupinbeforefor, like, librariesandstuff.
ButbutnotforfullWebmaps.
Soyousee, lastyearwebuild a Webcalledsquashandtobuildsmoosh, weusedweapon.
Andwhen I saywe, I reallymeanourcolleagueJason, whohandledtheweaponsoutofthingsandhe's inAmerica, basicallyhadtomakeuseofflotsoffundocumentedandinternalWebpackAPeyesjusttoachievebasicstuff, andhehasyearsoffmypackexperiencesreallycomfortablewithit.
Thetwoofus, ontheotherhand, don't yes.
Soas a result, likeWedidn't understandtheProjectBillsystemifsomethingwentwrongthatwasnotintrivial, whichmostofitwasnontrivial.
We'vegot a placeholderhereforthejobofscriptfilenamewhichwedon't knowaheadoftimebecause, asithadrollupwilladdhashtothefinalname.
Soweneedtopassinthatfinalfinalnameintoourtemplateingengineafterhashingandwecangetthis, as I saidfromthebundleobjectsinceittellsusboththeinputpathandtheoutputpath.
Soifwewantedourhtmltobe a slightlydifferentshape, wecouldjustgointothetempleitandchangeitnottoadd a newtag, rearrangethings, it's justHTML, butwhatdoweactuallyneedtochangetomakethingsfaster.
Thenwe'regonnaadd a prototypeforeachofthoseaswell.
Sowhat I reallylikeaboutthisthattherole a pluginhandlesalltheroleofspecificstuff, likemakingitawareoffthefilesputtingthemintothebuildpineappleandaddinghashes, blah, blah, blah, blah.
Andluckily, theroleofbundleobjectgivesustheanswerat a sadforeachjobisgoodpizzaout, butthatwehaveitwilllistgiveusanarrayoffatherbeingdirectlyorstaticallyimportedSointhiscase, wepassthatdataintoourtemperedenginebyjustlookingatthedotimportspropertyandbackoverinour E.
J S Templar.
Wecannowjustloopoverthesedependenciesandgenerate a prelowtagforeachofthem, justlikethat s Sowe'venowmovedourfontsontoourownserver.
Andthat's a onesecondimprovementonthree G and a massivethreesecondimprovementontoGee, wehaven't reallyimpactedtheredbar, thoughthetimewheretheuserseesabsolutelynothing.
Yeah, andfourseconds.
That's a lotofnothing.
Eightsecondsis a lot, A lotofnothing.
Thisisthepartwheretheuserisjuststaringat a whitescreen.
Theydon't evenknowiftheserveriseventhinkaboutsendingthem a response.
Andthenoncethejobscriptloadslazilyenhancethepageon, thereare a fewwaystoactuallydothis.
Everydormorchestrationframeworkthatisworthtalkingabouthas a waytogenerateanHTMLstringfromitscomponentsandinpreactandreactlandthatiscalledrenderedtostring.
Thisisprettyfast.
It's notasfastas a generalpurposetemplateingengine, butprettyclosetothepointwhere, actually, somepeopledorunthisoneveryrequest, althoughweonlywon't use a billtime.
Sosuperhighperformance.
It's notasbigof a requirementforusinthisparticularusecase, however, rendertostringrunsandno, andweactuallyseethataskindof a downsidebecauseifyouhaveanycodesinyourcomponentsthatassumestoberunninginthebrowser, whichusuallyis a fairassumptiontomakethatwillbreakandnote.
Sowehad a componentwithindexTB, andthatwouldjustbreak.
Well, lookingatthenetworkwaterfalltoremindyouthatthinblockisthesettingof a connectionandthestickblockisthetimeittakesfortherequestandtheresponsetogowiththewire.
Andthat's youknow, it's kindofliketreeshaking, butforfundsandforfunds, it's calledsubsetting, andtherearecommandlinetoolsthatdothisforyou, butthey'rewritteninpythonin a kindofloathpythonpython a littleonfeatureaboutthefunds.
Theyour L forthe C s s offyourphoneactuallytakes a parameter, whichlookslikethiswasthefirstlanguage I love.
I know.
Moveonhere.
Ifyouincludethistextparameter, theCSSwillcontain a yourallto a newfundfilewhich, specificallygeneratejustcontainthecharactersthatyou'reusinginthistextparameter.
Well, backtoourcreateHTMLplugin, oratleastthepartoffeatsdataintoourtemplateingengineforeachfundwerepacingintheweightandyour l butyou'realsogoingtopassintheinlinefundas a base.
64 encodedstrength.
Yeah, thisisjustusingbuiltinnoday p.
I isnothingspecial, butwe'realsogoingtopassintheUnicoderangeforeachfont.
Butitcandoeverythingthatweneededthatweneededtodosoreallywhatitdoesifyougiveit a promiseoff a component, itwrappeditandreturnto a realcomponentssynchronously.
Andyoucanusethatcomponentas a placeholderwithtwoparametersbasicallywilltake a loadingfunction, whichwillreputable, usedforrunning a placeholderuntiltheunderlyingcomponentsreadyandatthatpointjustswitchesoverandusestheotherfunction.
Likefor a nebula.
Yes, s.
Sowiththat, wemovedallofourcomponentsto a lazymodelexcepttheonesthatweneededforthefirstrenderonthiscoughover 20 K offthehtmlthatthejobscriptisnowdowntojust 11 k now, I mean, honestly, I think 11 cases a lotofjavascriptforwhatisbasicallyjust a simpleformon a buttonbut, youknow, it's doneitsjob.
Andthatmeanswhenyoucreate a PR, itwillcomparethatagainstmaster.
Soit'llgiveusthedeltaforallofthefiles.
AndsothatmeansforeveryPR, wejustgointothis.
Wehave a lookandyouwillbeabletoseeiftheindexhtmlfileisballooningin a waythatwedidn't expectthisThisworksforallprojectsthatuseTravis, sofeelfreetogiveit a go.
Andremember, whenyouareat a festivalon a trainonconferencelikehere, oryoujustonvacationandusingroaming, youwillbeexperiencingspeechthatspeedsthatclosertothree g orevento G sometimes.
Yeah, And I alsowantthey'replayingthegame.
Weinstalltheserviceworkerbecause, youknow, I'm notallowedtoshipanythingthatdoesn't have a serviceworkeronthatmeanslikeit's gonnaworkofflinefirst.
But, youknow, as a sideeffect, itmeansitcutsdownthetimingtolike, Well, prettymuchinstantly.
在構建工具的世界裡快速地做事情,由Surma和Jake Archibald主持|JSConf Budapest 2019 (Making things fast in world of build tools by Surma & Jake Archibald | JSConf Budapest 2019)