Fix Buffer conversion logic in writeFile.

This commit is contained in:
Ben Newman
2017-02-09 10:20:28 -05:00
parent f5ae115c10
commit 696b8d4b3c

View File

@@ -2419,10 +2419,11 @@ var writeFile = Profile("bundler writeFile", function (file, builder, options) {
const hash = file.hash();
if (options && options.sourceMapUrl) {
data = new Buffer(
addSourceMappingURL(data, options.sourceMapUrl),
"utf8"
);
data = addSourceMappingURL(data, options.sourceMapUrl);
}
if (! Buffer.isBuffer(data)) {
data = new Buffer(data, "utf8");
}
builder.write(file.targetPath, { data, hash });