lustre-labs / dev-tools

Lustre's CLI and development tooling: zero-config dev server, bundling, and scaffolding.
45 stars 15 forks source link

Show compiler errors in the browser when using the watcher / live reloader #23

Open jmpavlick opened 5 months ago

jmpavlick commented 5 months ago

As a developer, I should see compiler errors in the browser when using the watcher / live reloader, if the build fails.

The compiler errors should be displayed as a full-screen output listing, ideally with the same color-coding as is used by the terminal.

When the build is successful again, the page should refresh and display the successfully-compiled output.

——

@hayleigh-dot-dev’s notes:

in the live_reload module there's a script to inject the live reloading stuff, you'd probably add an extra case to

      socket.onmessage = (event) => {
        if (event.data === 'reload') {
          window.location.reload();
        }
      };

in the file watcher actor we just discard failing builds:

      case cli.run(script, Nil) {
        Ok(_) -> {
          use _, client <- set.fold(state, Nil)
          process.send(client, Reload)
        }

        Error(_) -> Nil
      }

but you could grab the error and do error.explain to get the error text, wrap it in a div and some stuff