New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken sourcemapping for vite after 5.0.13 #16534
Comments
maybe its this change that caused this 🤷 aff54e1#:~:text=s.prepend(mapDepsCode) |
That line should be fine because we update the sourcemap after that. vite/packages/vite/src/node/plugins/importAnalysisBuild.ts Lines 537 to 561 in aff54e1
|
Hello @bickauskaslaurynas. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Was not able to replicate with just Vite on a smaller project so kept looking, after a while I've identified that the issue was not vite itself but rather that the differently generated vite file after going through cloudflare js minification lost a line. |
Describe the bug
versions vite 5.1.x ( i think 5.1.0, 5.1.1, 5.1.2, 5.1.3 might be working) and 5.2.x generate sourcemaps that do not work
Noticed this issue after bumping to vite 5.1.7 and trying 5.2.10 to fix this did not help. Only thing that helped was reverting to 5.0.13.
I use sentry sourcemaps are uploaded there, the errors do not map to correct code currently with these latter versions
with 5.2.10 specifically there is a one line missmatch meaning that if my error shows that it occured for example on line 13, the sourcecode can be found by sourcemapping of line 14 not 13
possibly this has something to do with the __vite__mapDeps or __vite__fileDep code that is added to built js files
I thought that this was a sentry bug and reported the issue there getsentry/sentry-javascript-bundler-plugins#529
but they said it's probably a vite bug
Reproduction
i will try to create reproduction cant make my project public right now
Steps to reproduce
generate sourcemaps with vite 5.0.13 - sourcemaps work
bump to vite 5.1.7 - sourcemaps dont work
System Info
Used Package Manager
npm
Logs
5.0.13
generated sourcemap starts with:
{"version":3,"mappings":"mlGACMA,GAAkB,aAEXC,GAAmBC,GAAW,CAC1C,GAAI,CACH,OAAOA,EAAO,WAAWF,GAAiB,EAAE,EAAE,YAAW,CAC3D,MAAS,CACP,OAAOE,CACP,CACF,EAEMC,GAAY,CAACC,EAASC,IAAY,CAEvCD,EAAQ,QAAQ,GAAKH,GAAgBI,EAAQ,KAAK,CACnD,EAEaC,GAAoB,KAEpBC,GAAkB,CAC9B,YAAa,CAACH,EAASC,IAAYF,GAAUC,EAASC,CAAO,EAC7D,QAAS,CAACD,EAASC,IAAYF,GAAUC,EAASC,CAAO,CAC1D,ECrBeG,GAACC,GAAsB,wBAAqCA,CAAS,mGCWpF,MAAMC,EAAQC,EAERC,EAAWC,EAAS,IAAOH,EAAM,WAAaA
generated code starts with:
import{d as G,c,o as r,a as f,b as h,e as g,g as E6,i as B6,f as P6,t as A6,I as L6,u as de,r as P,h as D6,n as tt,j as Nt,k as B,l as re,m as Q,w as L,p as M,q as v,T as he,s as ps,v as Vt,x as C,y as ht,z as po,A as nh,B as _,C as y,D as xe,E as Ie,F as He,G as z6,H as $6,J as k,K as X,L as ue,M as pe,N as qs,O as bo,P as we,Q
5.2.10
generated sourcmap starts with:
{"version":3,"mappings":";ivGACMA,GAAkB,aAEXC,GAAmBC,GAAW,CAC1C,GAAI,CACH,OAAOA,EAAO,WAAWF,GAAiB,EAAE,EAAE,YAAW,CAC3D,MAAS,CACP,OAAOE,CACP,CACF,EAEMC,GAAY,CAACC,EAASC,IAAY,CAEvCD,EAAQ,QAAQ,GAAKH,GAAgBI,EAAQ,KAAK,CACnD,EAEaC,GAAoB,KAEpBC,GAAkB,CAC9B,YAAa,CAACH,EAASC,IAAYF,GAAUC,EAASC,CAAO,EAC7D,QAAS,CAACD,EAASC,IAAYF,GAAUC,EAASC,CAAO,CAC1D,ECrBeG,GAACC,GAAsB,wBAAqCA,CAAS,mGCWpF,MAAMC,EAAQC,EAERC,EAAWC,EAAS,IAAOH,EAAM,WAAaA,EAAM,IAAMF,GAAa,UAAUE,EAAM,GAAG,EAAE,CAAE,ihBCH/FI,GAAaC,EAAa,CAC9B,MAAO,CAAC,eAAe,EAEvB,SAAU,KAEV,SAAU,CACT,KAAK,SAAS,SAAW,IAAI,qBAAsBC,GAAY,CAE9D,KAAK,MAAM,gBAAiB,CAACA,EAAQ,CAAC,EAAE,cAAc,CACvD,EAAG,CACF,UAAW,CACZ,CAAC,EACD,KAAK,SAAS,SAAS,QAAQ,KAAK,MAAM,MAAM,CAChD,EAED,eAAgB,CACf,KAAK,SAAS,SAAS,UAAU,KAAK,MAAM,MAAM,CAClD,CACF,C
generated code starts with:
const __vite__fileDeps=["assets/chunk/Preview-123.js","assets/chunk/vendor-123.js","assets/chunk/SitePreview-123.js","assets/css/SitePreview-123.css","assets/css/Preview-123.css","assets/chunk/VersionHistory-123.js","assets/css/VersionHistory-123.css","assets/chunk/StoreManager-123.js","assets/css/StoreManager-123.css","assets/chunk/Auth-123.js","assets/css/Auth-123.css","assets/chunk/SiteNotFound-123.js","assets/css/SiteNotFound-123.css","assets/chunk/FormEmailVerification-123.js","assets/css/FormEmailVerification-123.css","assets/chunk/AiBuilder-123.js","assets/chunk/AiBuilderForm-123.js","assets/css/AiBuilderForm-123.css","assets/css/AiBuilder-123.css","assets/chunk/Templates-123.js","assets/css/Templates-123.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); import{d as G,c,o as r,a as f,b as h,e as g,g as E6,i as B6,f as P6,t as A6,I as L6,u as de,r as P,h as D6,n as tt,j as Nt,k as B,l as re,m as Q,w as L,p as M,q as v,T as he,s as ps,v as Vt,x as C,y as ht,z as po,A as nh,B as _,C as y,D as xe,E as Ie,F as He,G as z6,H as $6,J as k,K as X,L as ue,M as pe,N as qs,O as bo,P as we,Q as Ct,R as At,S as Vo,U as J,V as Dt,W as Et,X as mt,Y as ih,Z as te,_ as Me,$ as R6,a0 as M6,a1 as O6,a2 as H6,a3 a
(the whole const __vite__fileDeps=["as... is the first line of generated js code)
Validations
The text was updated successfully, but these errors were encountered: