Elm errors don’t show up on overlay anymore
sephii opened this issue · 1 comments
sephii commented
Using elm-webpack-loader 8.0.0 and elm-hot-webpack-loader 1.1.8 with webpack 5.74.0, the overlay now only shows the following information when there’s an Elm error:
Compiled with problems:
ERROR in ./assets/elm/Shop/Main.elm
Module build failed (from ./node_modules/elm-webpack-loader/index.js):
Compiler process exited with error Compilation failed
And you then need to go back to your terminal and scroll up to find the Elm errors. I know elm-webpack-loader used to show the Elm errors directly in the overlay which was really nice.
I don’t know why these errors stopped showing up in the overlay, but I managed to get them back by changing the compile
function:
function compile(sources, options) {
var suffix = getSuffix(options.output, ".js");
return new Promise(function (resolve, reject) {
temp.open({ suffix: suffix }, function (err, info) {
if (err) {
return reject(err);
}
options.output = info.path;
options.processOpts = { stdio: "pipe" };
var compiler;
try {
compiler = elmCompiler.compileSync(sources, options);
}
catch (compileError) {
return reject(compileError);
}
if (compiler.status !== 0) {
reject(compiler.stderr.toString("utf-8"));
}
fs.readFile(info.path, { encoding: "utf8" }, function (err, data) {
return err ? reject(err) : resolve(data);
});
});
});
}