Skip to content
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

feat: Add deps.includeSourcemap #7095

Closed
wants to merge 1 commit into from
Closed

Conversation

bgoscinski
Copy link
Contributor

@bgoscinski bgoscinski commented Dec 17, 2024

This option allows to control if inline source maps should be included in dependencies. This is useful when debugging inline dependencies. It was discussed in #6041 (comment)

To get correct line numbers you need to specify dependencies you wish to debug in deps.includeSourcemap and configure outFiles in .vscode/launch.json like this:

 {
   // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
   "version": "0.2.0",
   "configurations": [
     {
       "type": "node",
       "request": "launch",
       // ...
       "outFiles": [
         "${workspaceFolder}/**/*.(m|c|)js",
         "!**/node_modules/**",
+        "${workspaceFolder}/node_modules/**/date-fns/**/*.js"
       ]
     }
   ]
 }

fixes #5605

Description

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

This option allows to control if inline source maps should be included
in dependencies. This is useful when debugging inline dependencies

fixes vitest-dev#5605
Copy link

netlify bot commented Dec 17, 2024

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit edb898c
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6761fe1565504200095b08dc
😎 Deploy Preview https://deploy-preview-7095--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@aleclarson
Copy link
Contributor

I don't believe this PR will be necessary once vitejs/vite#19004 is merged. The problem was upstream (in Vite), where the SSR transform was not preserving the line offset of the original code. When the line offset is preserved, you don't need a sourcemap, since the SSR transform doesn't indent anything (which means the column offset is unaffected).

@bgoscinski
Copy link
Contributor Author

bgoscinski commented Dec 18, 2024

You're probably right @aleclarson! Thanks for looking into it.

I'll keep this PR open (as a draft) just in case for some reason yours won't be merged or for some reason won't fix #5605 :)

@bgoscinski bgoscinski marked this pull request as draft December 18, 2024 18:45
@aleclarson
Copy link
Contributor

Hey @bgoscinski, to be clear, my Vite PR absolutely fixes #5605. I tested with your reproduction 😄

@bgoscinski
Copy link
Contributor Author

Oh perfect! I'll take your word for it then :)

@bgoscinski bgoscinski closed this Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source maps in inlined deps are off by a few lines in VS Code
2 participants