Skip to content

Commit 73d9876

Browse files
author
evilebottnawi
committedMay 12, 2017
fix: source maps path on windows.
1 parent 3608136 commit 73d9876

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed
 

‎lib/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function(content, map) {
2121

2222
if(sourceMap) {
2323
if (map) {
24-
if (typeof map !== "string") {
24+
if (typeof map === "string") {
2525
map = JSON.stringify(map);
2626
}
2727

‎test/sourceMapTest.js

+28-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("source maps", function() {
1010
testWithMap("falsy: undefined map doesn't cause an error", ".class { a: b c d; }", undefined, [
1111
[1, ".class { a: b c d; }", ""]
1212
]);
13-
testWithMap("should don't generate sourceMap when `sourceMap: false` and map exist",
13+
testWithMap("should don't generate sourceMap when `sourceMap: false` and map exists",
1414
".class { a: b c d; }",
1515
{
1616
file: 'test.css',
@@ -28,7 +28,7 @@ describe("source maps", function() {
2828
sourceMap: false
2929
}
3030
);
31-
testWithMap("should don't generate sourceMap when `sourceMap: true` and map exist",
31+
testWithMap("should don't generate sourceMap when `sourceMap: true` and map exists",
3232
".class { a: b c d; }",
3333
{
3434
file: 'test.css',
@@ -54,6 +54,32 @@ describe("source maps", function() {
5454
sourceMap: true
5555
}
5656
);
57+
testWithMap("should don't generate sourceMap when `sourceMap: true` and map exists and string",
58+
".class { a: b c d; }",
59+
JSON.stringify({
60+
file: 'test.css',
61+
mappings: 'AAAA,SAAS,SAAS,EAAE',
62+
names: [],
63+
sourceRoot: '',
64+
sources: [ '/folder/test.css' ],
65+
sourcesContent: [ '.class { a: b c d; }' ],
66+
version: 3
67+
}),
68+
[
69+
[1, ".class { a: b c d; }", "", {
70+
file: 'test.css',
71+
mappings: 'AAAA,SAAS,SAAS,EAAE',
72+
names: [],
73+
sourceRoot: '',
74+
sources: [ '/folder/test.css' ],
75+
sourcesContent: [ '.class { a: b c d; }' ],
76+
version: 3
77+
}]
78+
],
79+
{
80+
sourceMap: true
81+
}
82+
);
5783
testMap("generate sourceMap (1 loader)", ".class { a: b c d; }", undefined, {
5884
loaders: [{request: "/path/css-loader"}],
5985
resource: "/folder/test.css",

0 commit comments

Comments
 (0)