Merge branch 'sveltejs:master' into master

pull/6758/head
Wojmis3 5 years ago committed by GitHub
commit be1d1a2786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,9 @@
# Svelte changelog # Svelte changelog
## Unreleased
* Handle preprocessors that return empty sourcemaps ([#6757](https://github.com/sveltejs/svelte/pull/6757))
## 3.42.6 ## 3.42.6
* Hide private preprocess typings ([#6622](https://github.com/sveltejs/svelte/issues/6622)) * Hide private preprocess typings ([#6622](https://github.com/sveltejs/svelte/issues/6622))

@ -79,10 +79,13 @@ function processed_content_to_code(processed: Processed, location: SourceLocatio
if (processed.map) { if (processed.map) {
decoded_map = decode_map(processed); decoded_map = decode_map(processed);
// offset only segments pointing at original component source // decoded map may not have sources for empty maps like `{ mappings: '' }`
const source_index = decoded_map.sources.indexOf(file_basename); if (decoded_map.sources) {
if (source_index !== -1) { // offset only segments pointing at original component source
sourcemap_add_offset(decoded_map, location, source_index); const source_index = decoded_map.sources.indexOf(file_basename);
if (source_index !== -1) {
sourcemap_add_offset(decoded_map, location, source_index);
}
} }
} }

@ -0,0 +1,7 @@
export default {
preprocess: {
style: ({ content }) => {
return { code: content, map: { mappings: '' } };
}
}
};

@ -0,0 +1,7 @@
<div class="foo">bar</div>
<style>
.foo {
color: red;
}
</style>

@ -0,0 +1,7 @@
<div class="foo">bar</div>
<style>
.foo {
color: red;
}
</style>
Loading…
Cancel
Save