diff --git a/lib/ConstPlugin.js b/lib/ConstPlugin.js index 8a568badb..a74193952 100644 --- a/lib/ConstPlugin.js +++ b/lib/ConstPlugin.js @@ -32,7 +32,7 @@ ConstPlugin.prototype.apply = function(compiler) { var bool = param.asBool(); if(typeof bool === "boolean") { if(expression.test.type !== "Literal") { - var dep = new ConstDependency(bool + "", param.range); + var dep = new ConstDependency(" " + bool + "", param.range); dep.loc = expression.loc; this.state.current.addDependency(dep); } diff --git a/test/cases/parsing/issue-1044/index.js b/test/cases/parsing/issue-1044/index.js new file mode 100644 index 000000000..ee8a1fb17 --- /dev/null +++ b/test/cases/parsing/issue-1044/index.js @@ -0,0 +1,5 @@ +it("should not crash on missing spaces", function() { + (function() { + return"function"==typeof define&&define.amd?"hello":"world"; + })(); +});