-
Notifications
You must be signed in to change notification settings - Fork 292
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
Relative sourcemap base #327
Conversation
There's a really odd CI failure on this one... |
Ok I just tested in a TypeScript project and I'm also seeing the source maps not applying there so this may actually be something to do with my setup. |
I had the same problem with the inspector and Chrome in the past couple weeks. Maybe it’s a mismatch between v8 in Node vs Chrome? Try VS Code and see if that works because the tsc source maps work for me with Code. I’ll restart CI. |
@guybedford This is really close! I found that the source map is observed by VS Code, however the line numbers look wrong. Steps to reproducegit clone https://github.com/styfle/ncc-bug-sourcemap
cd ncc-bug-sourcemap
git checkout pr327 Working with tscyarn build
code . # open with VS Code
node --inspect-brk dist
# Visit the Debugger and select "Attach" Not working with ncc# below is my copy of ncc built from your branch
/path/to/ncc/dist/ncc/cli.js build index.ts --source-map --no-source-map-register
code . # open with VS Code
node --inspect-brk dist
# Visit the Debugger and select "Attach" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's room for improvement here since the line numbers don't match up.
Codecov Report
@@ Coverage Diff @@
## master #327 +/- ##
=========================================
+ Coverage 69.45% 69.55% +0.1%
=========================================
Files 12 12
Lines 383 381 -2
=========================================
- Hits 266 265 -1
+ Misses 117 116 -1
Continue to review full report at Codecov.
|
I just tested this out and I can replicate the source maps issue. But in my own test, the source maps worked fine. I ran the source maps through the checker visualization at https://sokra.github.io/source-map-visualization/#custom and get them lining up correctly, see below. So the above actually seems to be a VSCode / debugger source maps issue. This might be due to Node.js issues with source maps, which are being fixed thanks to the new compileFunction approach which has been worked on by bcoe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes #319, by ensuring that the source maps paths match up to the input folder, using a custom
sourceMapsBasePrefix
option.Ideally the CLI should know to configure this option based on the output directory location relative pathing, but by default it will likely usually be
../
.I compared the source maps here to the ones generated by TypeScript and the output file is pretty much identical now, but when I tried testing with
node --inspect-brk
in the Chrome dev tools, I still couldn't get the source map to apply.I ran the source maps in the Webpack visualizer at https://sokra.github.io/source-map-visualization and can confirm they are all working 100%.
The only thing I can think here is either if my local setup isn't running file system source maps for some reason (so @styfle perhaps you can verify your side), or if the Webpack boostrap file is somehow making things invalid as it is the first source (
"/webpack/bootstrap"
). I tried changing this name to different forms but that didn't seem to make a difference.Not sure what else to try, but source maps debugging is always like this the first time :)