Skip to content

Ignore null source maps #99

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

Merged
merged 1 commit into from
Jul 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Ignore null source maps
fixes #84
closes #90
  • Loading branch information
markdalgleish committed Jul 13, 2015
commit 7b81a46b8814a2b830491a324b11e369233ee478
2 changes: 1 addition & 1 deletion lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = function(content, map) {
var root = query.root;
var moduleMode = query.modules || query.module;

if(typeof map !== "string") {
if(map !== null && typeof map !== "string") {
map = JSON.stringify(map);
}

Expand Down
20 changes: 20 additions & 0 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ exports.test = function test(name, input, result, query, modules) {
});
};

exports.testWithMap = function test(name, input, map, result, query, modules) {
it(name, function() {
var output = cssLoader.call({
options: {
context: ""
},
loaders: [{request: "loader"}],
loaderIndex: 0,
context: "",
resource: "test.css",
request: "css-loader!test.css",
query: query,
emitError: function(message) {
throw new Error(message);
}
}, input, map);
assetEvaluated(output, result, modules);
});
};

exports.testLocals = function testLocals(name, input, result, query, modules) {
it(name, function() {
var output = cssLoaderLocals.call({
Expand Down
12 changes: 12 additions & 0 deletions test/sourceMapTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*globals describe */

var testWithMap = require("./helpers").testWithMap;

describe("falsy source maps", function() {
testWithMap("null map doesn't cause an error", ".class { a: b c d; }", null, [
[1, ".class { a: b c d; }", ""]
]);
testWithMap("undefined map doesn't cause an error", ".class { a: b c d; }", undefined, [
[1, ".class { a: b c d; }", ""]
]);
});