}));
}
- if (comments.length > 0 && output.pos() == 0) {
- if (output.option("shebang") && comments[0].type == "comment5") {
+ if (output.pos() == 0) {
+ if (comments.length > 0 && output.option("shebang") && comments[0].type == "comment5") {
output.print("#!" + comments.shift().value + "\n");
output.indent();
}
output: { preamble: "/* Build */" }
}).code;
assert.strictEqual(code, "#!/usr/bin/node\n/* Build */\nvar x=10;");
- })
+ });
+
+ it("Should handle preamble without shebang correctly", function() {
+ var code = UglifyJS.minify("var x = 10;", {
+ fromString: true,
+ output: { preamble: "/* Build */" }
+ }).code;
+ assert.strictEqual(code, "/* Build */\nvar x=10;");
+ });
});