-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] use consistent relative source filename for js sourcemaps (#6598)
- Loading branch information
Showing
4 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/sourcemaps/samples/sourcemap-basename-without-outputname/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
import {magic_string_bundle} from '../../helpers'; | ||
|
||
export const component_filepath = 'src/some/deep/path/input.svelte'; | ||
export const component_file_basename = 'input.svelte'; | ||
export const css_file_basename = 'input.css'; | ||
|
||
const input_css = ' h1 {color: blue;}'; | ||
|
||
export default { | ||
preprocess: [ | ||
{ | ||
style: ({ content, filename }) => { | ||
const style_to_add = `/* Filename from preprocess: ${filename} */` + input_css; | ||
return magic_string_bundle([ | ||
{ code: content, filename: component_file_basename }, | ||
{ code: style_to_add, filename: css_file_basename } | ||
],component_filepath); | ||
} | ||
} | ||
], | ||
js_map_sources: [component_file_basename], | ||
css_map_sources: [css_file_basename,component_file_basename], | ||
options: { | ||
filename: component_filepath | ||
}, | ||
compile_options: { | ||
filename: component_filepath, | ||
// ../../index.ts initializes output filenames, reset to undefined for this test | ||
outputFilename: undefined, | ||
cssOutputFilename: undefined | ||
} | ||
}; |
2 changes: 2 additions & 0 deletions
2
test/sourcemaps/samples/sourcemap-basename-without-outputname/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>sourcemap-basename-without-outputname</h1> | ||
<style src="input.css">h1 {color: red;}</style> |
3 changes: 3 additions & 0 deletions
3
test/sourcemaps/samples/sourcemap-basename-without-outputname/test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// no additional test needed, _config.js values and the js.map.sources assertion in ../../index.ts cover it | ||
export function test() {} | ||
|