Open pcattori opened 7 months ago
Seems like one potential cause could be settings the sourcemap
to null
:
See https://rollupjs.org/plugin-development/#source-code-transformations
I actually have an app (cannot share this one and not sure if I can reproduce in a simpler reproduction app) where, in dev in Chrome dev tools, the console.log shows 143 lines earlier than it actually is (line 128 vs line 271) with latest Remix stable 2.7.2 (and Vite with Cloudflare preset).
I'm also experiencing this problem in my remix+cloudflare setup. Good to see there's an open PR for this, thanks @IgnusG!
I'm seeing this too with a remix SPA + tailwind setup - it's infuriating!
https://github.com/remix-run/remix/assets/1628365/1bdf438a-e26c-4c7e-9ff0-2abccf2e58d7
https://github.com/remix-run/remix/pull/8970 fixes this issue for me.
+1 for suffering with this issue. Hanging in there for the PR to merge... Thanks 🙏
Looks like the PR was merged! :) @pcattori should we expect a minor with this fix soon? cheers!
I have updated remix
to 2.9.0-pre.4
but still have this issue. The debugger
is a few lines below:
@latata can you use vite-plugin-inspect and sourcemap visualization to determine what's causing your mismatch? Alternatively, you can provide a reproduction in StackBlitz
Reproduction
npx create-remix@latest --template remix-run/remix/templates/unstable-vite
console.log
inapp/routes/_index.tsx
in the module scope above thedefault
component export_index.tsx
for the logged messageconsole.log
lineAdditionally, if
loader
is added aboveconsole.log
, seems to also offset the sourcemap for theconsole.log
to the last line of theloader
. Clicking on a line to add a breakpoints now also sometimes sets the breakpoint on a different line.System Info
Used Package Manager
npm
Expected Behavior
Clicking on link to sourcemap from within console goes to the correct line. Clicking on line to add a breakpoint sets the breakpoint on that line.
Actual Behavior
Sourcemaps seems to be offset by a small number of lines.