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

fix: ensure source maps can be traced by debugger #886

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

aleclarson
Copy link
Member

  • Populate the sourcesContent array
  • Resolve relative paths in the sources array

The sourcesContent of a source map can be null, which makes the devtools ask Vite for the original source. This can lead to Vite responding with transformed code, since Vite supports importing TypeScript directly. By populating the sourcesContent before sending the source map, the devtools won't need to ask Vite for the original source directly.

The sources array may contain relative paths, which are resolved to a /@modules/ path by the devtools. It would be better to know the actual path of the original source, so this PR resolves the relative path before sending the source map to the debugger.

- Populate the `sourcesContent` array
- Resolve relative paths in the `sources` array

The `sourcesContent` of a source map can be null, which makes the devtools ask Vite for the original source. This can lead to Vite responding with transformed code, since Vite supports importing TypeScript directly. By populating the `sourcesContent` before sending the source map, the devtools won't need to ask Vite for the original source directly.

The `sources` array may contain relative paths, which are resolved to a /@modules/ path by the devtools. It would be better to know the actual path of the original source, so this PR resolves the relative path before sending the source map to the debugger.
@yyx990803 yyx990803 merged commit ba7442f into vitejs:master Oct 23, 2020
@aleclarson aleclarson deleted the fix/sourcemap-content branch October 27, 2020 19:08
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.

2 participants