Closed bickauskaslaurynas closed 4 months ago
maybe its this change that caused this 🤷 https://github.com/vitejs/vite/commit/aff54e1#:~:text=s.prepend(mapDepsCode)
That line should be fine because we update the sourcemap after that. https://github.com/vitejs/vite/blob/aff54e1d5e3129a442aeec8b6aef024024ba5b1b/packages/vite/src/node/plugins/importAnalysisBuild.ts#L537-L561
Hello @bickauskaslaurynas. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs reproduction
will be closed if they have no activity within 3 days.
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. After turning off this minification sourcemapping works.
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 vitemapDeps or vitefileDep code that is added to built js files
I thought that this was a sentry bug and reported the issue there https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/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 vitefileDeps=["as... is the first line of generated js code)
Validations