-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es): Improve sourcemap url error messages. (#9422)
**Description:** Parse based on the provided prefix: inline urls must start with "data:", so only trying one will ensure the correct and more helpful error message will be shown. Currently, any error while trying to load a sourcemap file will give the unhelpful error: ``` ERROR failed to read input source map: failed to parse inline source map url index.js.map Caused by: relative URL without a base at <snip>/swc-<ver>/src/lib.rs:386 ``` Further, for the common "missing file" error, give a better message that hopefully describes the two paths tried, rather than increasing confusion by talking about a `.js.map.map` file if it was correct. Now it will show, for example: ``` ERROR failed to read input source map: failed to find input source map file "index.js.map" in "file:///D:/github/skilitics/billing/api-client/lib/services/index.js" file as either "file:///D:/github/skilitics/billing/api-client/lib/services\\index.js.map" or with appended .map at D:\github\swc-project\swc\crates\swc\src\lib.rs:400 ``` (This example appears to be an issue in swc-node, where it is passing a file URL which is treated as a path, and therefore never exists, I'm working on a PR for there too) There are more improvements that could make this code clearer and more reliable, but this should resolve many of the confused users (including me!) **Related issue:** See (maybe can be considered to fix): #8944, #8910 [PR in swc-node to fix the originating issue](swc-project/swc-node#840)
- Loading branch information
1 parent
55f7268
commit 230d1d9
Showing
2 changed files
with
38 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
swc: patch | ||
swc_core: patch | ||
--- | ||
|
||
fix(common): Better sourcemap url error messages. |
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