vaadin / beverage-starter-flow

Simple Example Web Application for Vaadin Flow
https://vaadin.com/flow
25 stars 30 forks source link

stats.json file is "corrupt" #309

Closed caalador closed 5 years ago

caalador commented 5 years ago

When having the babel setup in webpack configuration the sources in the stats.json will be what babel generates. We can not parse this at all and should generate is before babel

bogdanudrescu commented 5 years ago

On a clean 2.0 project mvn clean install then mvn jetty:run. @caalador is it the same exception you got?

d/[indlexa.bjs l(e10101 mKaiBt)56 h(idenod[eH.anjdleer1 -m F i bluliIlndt/iendetx.etsy5..jsse (r1v.12 MriB)
[webpack]e sINFtO. jca.v.vf.as:.1D0e3vM[dme)Hataatdi/[be1vemraaget-t[artyer-.mfl oow/rnodse_emodrulves/e@rpo.lhymaer/giron.-iceoncselt-sivgp/inron-icdolnseet-se.sjvge.jrs?b.aHbealn-dtarlgeetr=Wes5r a8.p4p4 KeirB .[hbuiand l e r  - jacakv] aI:NF1O c.v.f.s.D evM(oeH[a1ndmler4 -   4    S./cma[in.mj)s?bk/gworkspa.cee_v.aadin/beveercalgie-sptsartee.r-fjleowt/nocde_mloidulpess/e@.pjolytmery/.polsymeer/lrivb/eelrements/c.uhsatomn-dstyllee.jse[waebtpck[] IrNF.O Hct.tv.pfC.s.oDnevMondeHaendclteir -o nWARNmING  in oerntr.ypoiontg si.zeec lliipmsiet:. Thne Ffiolllolwinjg eetnttyrypo.iinot(.sC) hcaombainbedn asnseet lsilzee eExncdeePdosi ntth$e2 r eco(mm.endruned lim[t1 (2m44 KiB). HTthtis  can( ipmpacCt e[b1 pmeCrhfaonrnmaneceo.iel-otnarg.et=jes5a 3 7 bytves[[b1uimlt]abejve1ra[e-setarttemr-fl)ow/tnode_myodu.lses/e@vode_pmeodulSecso/p@epdoHly mer(/ro[n1-imcSon/eirronv-ilceon.nlEn[dwPeobipnatc.k]j INnFOe cc.vt.if.os.aDevvMondeH.anadle:r j- Eant1ryp1oivnat:s:2
60e8bpack] IN[Om )c. cv.mf. so.rDgevM.oedecHanle[r -l    i  1m| p/Usseers./jbeogdtatn/yw.orske/worrvkseprac.eS_vaeadirnv/beerver.ahgea-stnadrtelr-eflat[wm/n oodre_gmod.ul es/@v(ad[i1nm/vSaeadirnv-iecron.sj/vaaavdai:n-5iv . f . s.De[M1omdaetHndl[emr  - o  in[dex m()1010 KiBr))/badtinvaadin-lumo-stmyle s/typograp(hy.s ?baboerl-tgar.gete=es6[ 3.415m SKiBc [bluiiplste]
g.[webpack]e IcNFO [.bujilt]es.xDteHvM ode(Hnd[l1era -      |n d/Userls/beorgd.adn/wooSrk/cwoorkpsepace_vmaCadoin /b(evneraget-steaxrte-fl[ow/1nmodCe_mtodulesH/@vaanaddino/vaadinn-tlumlo-stylees/rsizCinge.js?baxtbHela-nc.v.f .s. Dev Mod eHalnidlr - [   1   pbuild/isndexe.js r  g . |e c   l i+ p25s6 ehidAdenb m.ojedutltesygdjaan/vwosrk/worekrspavcea_vaadi:n1/b2e4ve7rg[e-estarterr.-fsleosws/nmodie_moon.Sdueless/s@va)adin/
ma.j[ewebtptya.ck]u INFtO c.iv.lf.s.tDevMoeH[anmdler - .  index.es5t (1h.12  MiB)or hidkd.ens ucmcoedulees
e[rwebgpacak] IdNFO. c.ev.f..s.DQevMcodelHanudleer u- e  ips  e . jbeutitlyd./iion.dAebxs.tersa5c.tjCsonnection$_vjaadeina/be:vertaget-styart.er-sflowe/norde_vmodeul1es/5@vraad.hina/nvaaddiln-iecorns/.vaaSdi5n-i7cocns.oRead[Cwaebplalck] INFOb c.av.f.csk.s.DeuvMcodedHThaceededrnedaldeProo l- steti siozen li.mijt: aThve faoll:ow3ing0 a5sse([s) mex)ceedes?.bajbele-ttatyr.geste=ejs5 e1.r29 vKieBr [.bhuitlt]
[webpack] INFO c..v.rfu.s.DevModenHanJdl er( - vModeHHaannddlelr -e      |r /.USsecrosp/ebdoHgadndlera.nh/awnodrlke/workspacee_vaadrinC/b ev([roagllece-stta1rtemrS-fcloopwe/dnHodea_nmoddluelre.sj/a@vaadinv/vaaa:din1-4luwe1bmpacko] INbFO Ac.bvs.tfr.asc.tDCeovMo deHandler -( WANInNG nine wecbptacki peorf[orm1ance nrec.ommjendaatvionas: :
3m[weQbp0ack5] uINeFOc.[v.fm.su.DeevM)odeHDv[Momde)Hanbulilt]ej-a   :   | 1/Usvers/ab:ogd4a8n/w0orkwormksp)ace_
andlder -T hYou rcean limit t he size of your  bun d lesa by usindg Piomoporlt.() or equire.e[nsur1e to mlaazy ltoa[ msome pjaartsv aof: 7your6 ap polricagtio.n.5oawv/an:od1e_2m6ou[lme)s/@vtaadeinx
wme)bpack]e INFcO lci.vp.f.ss.D.s.eDsetvMod eHand.lfer -   biulilKiBe r[bCouill][es6  14.o3 KilB [ibpuilt]s
evMod eHeand.lejre -  For  m ore intfo vitsyit ht.tpsi:o.//webFpack.jsi.lorguide[s/c1odel-spIlnitttinegr/es5n 1d.l08n K.iBe [bruihla.tH]n
st.fillablemat (FillInterest.java:103)ev.ModheHaanndlderl -e  l  e  | /Users/b ogd(an/ wo(r[/1wormkCspaocne_tveaaxdtHanin/dbleveerag-starte[r-rflow/noCdeo_lmolduelcetsi/o@vana.dinj/avvaaa:din2-2l0u[o-styles/version.jms)     org.eclipse.jetty.util.thread.QueuedThreadPool$2.runQueuedThreadPoo1mat org.eclipse.jetty.io.ChannelEndPoint$2.runl.java:683)
     (at java.ChannelEndPoint.java:118)lang.Thread.runH  a  |s /Users/sboigodannH/waorkn/wordkslpaece_nvaaddiln/breve.rjagae-setartre.jra-flovw/nodae_mo:dules/1@pol5ym5e7r/po
    Thread.java:748)Wcr.v .f.os.aDevpModpeHerrandlegr.ec l-i  p s  e |. /javaUs:ers1/bo3gd2an/or[k/wmo)rksp
1mat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:765)/l[ib./elHem1maentts[om-mmoduale.jnsd?balbel -taorrgetg=ees5 r6..48 eKcilB i[pbuilt]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:683)/beogdtaino/nw.ohrakn/dwloerkspace_vaadin /bev(e (rge[-sar[ter1-fmlowS/noeder_movdulees/r@p.olyjmera/povlyamer:/l5ib/0el2emen1ts/mcu    at java.lang.Thread.run (Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.vaadin.flow.server.StaticFileServer
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass (SelfFirstStrategy.java:50)eac.ej_vaeatditny/be.vseerge[-srtartvemr-f)loew/rno
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass (ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:239)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass (WebAppClassLoader.java:556)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:357)
    at com.vaadin.flow.server.VaadinServlet.createStaticFileHandler (VaadinServlet.java:107)
    at com.vaadin.flow.server.VaadinServlet.init (VaadinServlet.java:83)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet (ServletHolder.java:672)
    at org.eclipse.jetty.servlet.ServletHolder.getServlet (ServletHolder.java:521)
    at org.eclipse.jetty.servlet.ServletHolder.prepare (ServletHolder.java:805)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle (ServletHandler.java:537)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle (ScopedHandler.java:146)
    at org.eclipse.jetty.security.SecurityHandler.handle (SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:257)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle (SessionHandler.java:1588)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle (ContextHandler.java:1345)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope (ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope (ServletHandler.java:480)
    at org.eclipse.jetty.server.session.SessionHandler.doScope (SessionHandler.java:1557)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope (ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope (ContextHandler.java:1247)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle (ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle (ContextHandlerCollection.java:220)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle (HandlerCollection.java:126)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle (Server.java:502)
    at org.eclipse.jetty.server.HttpChannel.handle (HttpChannel.java:364)
    at org.eclipse.jetty.server.HttpConnection.onFillable (HttpConnection.java:260)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded (AbstractConnection.java:305)
    at org.eclipse.jetty.io.FillInterest.fillable (FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run (ChannelEndPoint.java:118)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:765)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:683)
    at java.lang.Thread.run (Thread.java:748)
[qtp2100060610-27] WARN com.vaadin.flow.server.DefaultDeploymentConfiguration - 
===========================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
===========================================================
[qtp2100060610-27] INFO c.v.f.s.DevModeHandler - Webpack is running at http://localhost:51703
bogdanudrescu commented 5 years ago

At the second browser reload, the app works fine.

caalador commented 5 years ago

Initially for a clean branch I get the java.lang.NoClassDefFoundError: com/vaadin/flow/server/StaticFileServer, but on the reload I get java.lang.IllegalArgumentException: Unable to create an instance of 'com.vaadin.starter.beveragebuddy.ui.views.reviewslist.ReviewsList'. The constructor threw an exception.

caalador commented 5 years ago

Somehow seems like it's getting the es5 transpiled sources, even though we should always only get the es6 sources even if es5 sources are available.

manolo commented 5 years ago

Yep, seems that randomly it could take one or another value in the file

       "name": "./src/views/reviewslist/reviews-list.js?babel-target=es6",
       "name": "./src/views/reviewslist/reviews-list.js?babel-target=es5",
     "name": "./src/views/reviewslist/reviews-list.js?babel-target=es6",
     "name": "./src/views/reviewslist/reviews-list.js?babel-target=es5",
caalador commented 5 years ago

Fixed with:

diff --git a/flow-server/src/main/java/com/vaadin/flow/component/polymertemplate/BundleParser.java b/flow-server/src/main/java/com/vaadin/flow/component/polymertemplate/BundleParser.java
index f9b85b33e14a84c0ddd0a2815afd350616b916e2..c9955efedce15edbefe944e05c15d53fb6ecb3a4 100644
--- a/flow-server/src/main/java/com/vaadin/flow/component/polymertemplate/BundleParser.java
+++ b/flow-server/src/main/java/com/vaadin/flow/component/polymertemplate/BundleParser.java
@@ -182,7 +182,7 @@ public final class BundleParser {
                     .replaceFirst("^(./)frontend/", "$1")
                     // Replace the flow frontend protocol
                     .replaceFirst("^frontend://", ".");
-
+if(name.endsWith("es5")) {return source;}
             // Remove query-string used by webpack modules like babel (e.g ?babel-target=es6)
             name = name.replaceFirst("\\?.+$", "");
caalador commented 5 years ago

The NPE should be fixed at the same time in BundleParser so that if we don't have a Template getter then we would just return an empty template element.

bogdanudrescu commented 5 years ago

I also consistently get

Caused by: java.lang.IllegalStateException: Can't find resource './src/views/reviewslist/reviews-list.js' or 'META-INF/resources/stats.json'via the ClassLoader
    at com.vaadin.flow.component.polymertemplate.NpmTemplateParser.getTemplateContent(NpmTemplateParser.java:108)
    at com.vaadin.flow.component.polymertemplate.TemplateDataAnalyzer.parseTemplate(TemplateDataAnalyzer.java:187)
    at com.vaadin.flow.component.polymertemplate.TemplateInitializer.<init>(TemplateInitializer.java:94)
    at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:107)
    at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:122)
    at com.vaadin.starter.beveragebuddy.ui.views.reviewslist.ReviewsList.<init>(ReviewsList.java:78)
    ... 53 more