Open Rich-Harris opened 3 years ago
CC'ing our recent source mapping experts @dmitrage @milahu :smile:
could be easy as https://github.com/sveltejs/svelte/compare/master...milahu:patch-2
Is it how preprocess is expected to work then?
filename
(not file://
url) to preprocesssources
relative to component source file location (basename for component itself)apply_preprocessor_sourcemap
), we resolve sources to file://
form relative to passed urlExample:
preprocess map sources: ["index.svelte", "external.css"]
compile input filename: file:///path/to/project/index.svelte
result map sources: ["file:///path/to/project/index.svelte", "file:///path/to/project/external.css"]
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the bug If you pass
filename
andoutputFilename
options tosvelte.compile
, thesources
property of the resulting sourcemap will contain a relative path fromoutputFilename
tofilename
(and likewise forcssOutputFilename
). This is the only thingoutputFilename
is used for.sources
is used inconsistently in the wild; it's often unclear whether it's supposed to be describing filepaths or URLs. We treat it as a an array of filepaths, but that sometimes yields unwanted results: https://github.com/snowpackjs/snowpack/discussions/1941#discussioncomment-210899.In the case where
to
is absolute,relative(from, to) === to
should be true.file://
URLs are absolute, but we don't treat them as such.To Reproduce
Expected behavior
outputFilename
should be disregarded,sources
should equal[filename]
. Instead we get../../../file:///path/to/project/index.svelte
.Severity Not critical — possible to workaround.