Skip to content

Commit aa11402

Browse files
committed
use absolute paths and remove sourceRoot when generating sourcemaps
1 parent d7317ca commit aa11402

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

lib/loader.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,9 @@ module.exports = function(content, map) {
9797
map = result.map;
9898
if(map.sources) {
9999
map.sources = map.sources.map(function(source) {
100-
source = source.split("!").pop();
101-
var p = path.relative(query.context || this.options.context, source).replace(/\\/g, "/");
102-
if(p.indexOf("../") !== 0)
103-
p = "./" + p;
104-
return "/" + p;
100+
return source.split("!").pop();
105101
}, this);
106-
map.sourceRoot = "webpack://";
102+
map.sourceRoot = "";
107103
}
108104
map.file = map.file.split("!").pop();
109105
map = JSON.stringify(map);

test/sourceMapTest.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ describe("source maps", function() {
2121
file: 'test.css',
2222
mappings: 'AAAA,SAAS,SAAS,EAAE',
2323
names: [],
24-
sourceRoot: 'webpack://',
25-
sources: [ '/./folder/test.css' ],
24+
sourceRoot: '',
25+
sources: [ '/folder/test.css' ],
2626
sourcesContent: [ '.class { a: b c d; }' ],
2727
version: 3
2828
}]
@@ -38,8 +38,8 @@ describe("source maps", function() {
3838
file: 'test.css',
3939
mappings: 'AAAA,SAAS,SAAS,EAAE',
4040
names: [],
41-
sourceRoot: 'webpack://',
42-
sources: [ '/../../folder/test.css' ],
41+
sourceRoot: '',
42+
sources: [ '/folder/test.css' ],
4343
sourcesContent: [ '.class { a: b c d; }' ],
4444
version: 3
4545
}]
@@ -55,8 +55,8 @@ describe("source maps", function() {
5555
file: 'test.scss',
5656
mappings: 'AAAA,SAAS,SAAS,EAAE',
5757
names: [],
58-
sourceRoot: 'webpack://',
59-
sources: [ '/./folder/test.scss' ],
58+
sourceRoot: '',
59+
sources: [ '/folder/test.scss' ],
6060
sourcesContent: [ '.class { a: b c d; }' ],
6161
version: 3
6262
}]

0 commit comments

Comments
 (0)