question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

preact-ts sourcemap wrong line number

See original GitHub issue

Describe the bug

Using preact-ts template in dev mode produces wrong line numbers in source maps.

Reproduction

  1. npm init @vitejs/app vite-preact-ts --template preact-ts
  2. cd vite-preact-ts
  3. npm install
  4. In app.tsx add console.log('line 4'); on line 4
  5. npm run dev
  6. Open console in Chrome, the log will say line 4 - app.tsx:3

The line numbers are not just off by 1, with real components, they can be off by 20 lines or more.

image

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

System:
    OS: Windows 10 10.0.18363
    CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
    Memory: 15.94 GB / 31.59 GB
  Binaries:
    Node: 12.20.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.10 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.18362.449.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    vite: ^2.1.5 => 2.1.5

Used package manager: npm

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
piotr-czcommented, Sep 9, 2021

Quick fix:

npm uninstall @preact/preset-vite
npm install --save-dev @preact/preset-vite

This will install latest dependencies, including @prefresh/vite with 2.2.3 version which contains bugfix mentioned by @TobiasMelen

0reactions
sapphi-redcommented, Apr 13, 2022

Looks like it was a upstream issue and it was fixed. I will close this issue because I confirmed it is now working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect line numbers - sourcemaps, Webpack 2 Typescript
ts in Chrome Developer Tools so I am wondering if there is a way to change my Webpack sourcemap settings to see the...
Read more >
source-map-support - npm
It uses the source-map module to replace the paths and line numbers of source-mapped files with their original paths and line numbers.
Read more >
Incorrect Line Numbers - Sourcemaps, Webpack 2 ... - ADocLib
This module provides source map support for stack traces in node via the V8 stack trace API. It uses the sourcemap module to...
Read more >
Easy Debugging In React With WebPack Source Maps - Medium
devtool : 'inline-source-map'. Now when we encounter an error in the console, It'll point us to the correct file and line. Cool huh??...
Read more >
Source Maps - Rollbar Docs
Stack traces will contain the original source filename, line number, method name, and code coordinates; Error grouping will be more resilient to code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found