Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elm errors don’t show up on overlay anymore #229

Open
sephii opened this issue Oct 24, 2022 · 1 comment
Open

Elm errors don’t show up on overlay anymore #229

sephii opened this issue Oct 24, 2022 · 1 comment

Comments

@sephii
Copy link

sephii commented Oct 24, 2022

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);
          });
        });
    });
}
@Arrow7000
Copy link

Apparently there is already a PR to fix this, it just needs to be merged by someone with write access 😕 #224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants