diff --git a/index.js b/index.js index 21bc8dd..ff4cf66 100644 --- a/index.js +++ b/index.js @@ -163,7 +163,7 @@ function compile(sources, options) { return reject(err); } options.output = info.path; - options.processOpts = { stdio: "inherit" }; + options.processOpts = { stdio: "pipe" }; var compiler; @@ -174,9 +174,14 @@ function compile(sources, options) { return reject(compileError); } + // Catch output from stderr so we can use it in resolve + var errorChunks = []; + compiler.stderr.on('data', (data) => errorChunks = errorChunks.concat(data)); + compiler.on("close", function (exitCode) { if (exitCode !== 0) { - return reject("Compilation failed"); + var errorText = Buffer.concat(errorChunks).toString(); + return reject("Compilation failed! " + errorText); } fs.readFile(info.path, { encoding: "utf8" }, function (err, data) {