FredKSchott / snowpack

ESM-powered frontend build tool. Instant, lightweight, unbundled development. ✌️
https://www.snowpack.dev
MIT License
19.48k stars 921 forks source link

🐛 BUG: TypeScript types aren't source mapped #3644

Open TimMensch opened 3 years ago

TimMensch commented 3 years ago

Quick checklist

What package manager are you using?

yarn (though tried a sample with npm as well)

What operating system are you using?

Windows 10

Describe the bug

As you can see in this image, the source files for this project have been converted to JavaScript and are shown as JavaScript in the Firefox Source view:

image

Similar for the Sources view in Chrome:

image

What I expect is for the source maps to be automatically properly configured so that what I see in those trees is the TypeScript files.

I first discovered this in my own project (in attempting to convert to Snowpack), but found it also happens in this example Snowpack TypeScript project:

https://github.com/thisislawatts/printable-calendar/

Please tell me there's a fix for this. I tried searching likely terms and only found a feature request for source map transforms?

If this is a missing feature, then really it's an absolute showstopper bug for using Snowpack; source maps have been an essential feature for JavaScript debugging for something like a decade now, and lack of solid source map support should be a warning on the front page of your site; consider this to be a documentation bug instead.

Steps to reproduce

  1. Do this:
    git clone https://github.com/thisislawatts/printable-calendar/
    cd printable-calendar
    npm ci
    npm start dev
  2. Edit the Snowpack config to add buildOptions: { sourcemap: true }
  3. Your browser should open pointing at the printable-calendar demo. Open up the developer view (Ctrl-Shift-i on Windows; note I only tested in Firefox and Chrome).
  4. In Firefox: Select the Debugger tab. In Chrome, Select the Sources tab.
  5. Navigate to the src/lib folder.
  6. Note that the files show up here as .js files and are in fact the compiled JavaScript. Expected to see the source-mapped TypeScript here instead.

Link to minimal reproducible example (optional)

https://github.com/thisislawatts/printable-calendar/

TetianaZa commented 2 years ago

I have the same problem. Would be really nice to have it solved !!