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

Add filename to combined source map if needed #6089

Merged
merged 3 commits into from
Jul 23, 2021

Conversation

dummdidumm
Copy link
Member

When source maps are combined and the leading map is empty, sources is not set. Add the filename to the empty array in this case. This may be an upstream issue (but maybe it's also intended, let's see) but either way for our cases it's necessary to set sources even for empty maps.
They were not added before this change so I adjusted the tests. The js.map output now is closer to what it would be like if there was no preprocessing and there's no JS - in that case Svelte outputs an empty map with sources set which looks like this

{
    version: 3,
    names: [],
    sources: [ '..path/to/$layout.svelte' ],
    sourcesContent: [ '<p>asd</p>\r\n' ],
    mappings: ';;;;;;;'
}

Related sveltejs/kit#424

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. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

Simon Holthausen added 2 commits March 15, 2021 09:11
When source maps are combined and the leading map is empty, sources is not set. Add the filename to the empty array in this case.
Related sveltejs/kit#424
@dummdidumm
Copy link
Member Author

Now that this is unblocked in Kit we could just wait with this PR until the upstream issue is answered/resolved

@benmccann
Copy link
Member

Do we still want this PR now that things are working in SvelteKit?

@dummdidumm
Copy link
Member Author

There might be a need for it: sveltejs/svelte-loader#171 (comment) . Needs more investigation if that would fix it though.

@benmccann benmccann changed the title Add sources to combined map if needed Add filename to combined source map if needed Jul 23, 2021
@benmccann benmccann merged commit 4ca2af4 into sveltejs:master Jul 23, 2021
@Conduitry
Copy link
Member

This has been released in 3.40.2.

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.

None yet

3 participants