-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
fix: source maps path on windows
#532
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,17 @@ module.exports = function(content, map) { | |
var resolve = createResolver(query.alias); | ||
|
||
if(sourceMap) { | ||
if (map && typeof map !== "string") { | ||
map = JSON.stringify(map); | ||
if (map) { | ||
if (typeof map === "string") { | ||
map = JSON.stringify(map); | ||
} | ||
|
||
if (map.sources) { | ||
map.sources = map.sources.map(function (source) { | ||
return source.replace(/\\/g, '/'); | ||
}); | ||
map.sourceRoot = ''; | ||
} | ||
} | ||
} else { | ||
// Some loaders (example `"postcss-loader": "1.x.x"`) always generates source map, we should remove it | ||
|
@@ -30,8 +39,8 @@ module.exports = function(content, map) { | |
|
||
processCss(content, map, { | ||
mode: moduleMode ? "local" : "global", | ||
from: loaderUtils.getRemainingRequest(this), | ||
to: loaderUtils.getCurrentRequest(this), | ||
from: loaderUtils.getRemainingRequest(this).split("!").pop(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the output of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michael-ciniawsky we can have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Best get file from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. kk also not really related to this PR, just pop into my eyes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bebraw why? what is bad in use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @evilebottnawi I'm not entirely sure. At least test-wise the current implementation passes. It's fine to refactor later. 👍 |
||
to: loaderUtils.getCurrentRequest(this).split("!").pop(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be equal to |
||
query: query, | ||
minimize: this.minimize, | ||
loaderContext: this, | ||
|
@@ -105,11 +114,11 @@ module.exports = function(content, map) { | |
map = result.map; | ||
if(map.sources) { | ||
map.sources = map.sources.map(function(source) { | ||
return source.split("!").pop(); | ||
return source.split("!").pop().replace(/\\/g, '/'); | ||
}, this); | ||
map.sourceRoot = ""; | ||
} | ||
map.file = map.file.split("!").pop(); | ||
map.file = map.file.split("!").pop().replace(/\\/g, '/'); | ||
map = JSON.stringify(map); | ||
moduleJs = "exports.push([module.id, " + cssAsString + ", \"\", " + map + "]);"; | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test with
path.sep
? But I think it's unnecessary...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-ciniawsky yep, we should already changed
\
to/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-ciniawsky This is a source map check. Can we assume forward slash there due to browser environment?