purescript / purescript/spago

Improve "missing esbuild" error message

Open
#902 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bundle
Dominant language
PureScript
Stars
831
Forks
137
PR merge metrics
No merged PRs in 30d

Description

Hey there,

while I do think the current error message is quite okay...

Failed to find esbuild. See https://esbuild.github.io/getting-started/#install-esbuild for ways to install esbuild.

https://github.com/purescript/spago/blob/310a7096b0d3e86f6464c667aa2339045d85d505/src/Spago/Build.hs#L452

I'd suggest to extend it:

  • Add the information that it is spago that failed to find it. If spago is executed directly it's easy to figure out. But if a project is executed (e.g. with webpack or vite), you see a bunch of error messages and one of them is this, it's not clear where this is coming from.
  • Add why or what for esbuild is missing. Again it might not be clear why spago build is working fine, and then another command spago bundle-app is failing. Especially if the user is not directly running the command. So stating that spago relies on esbuild to bundle would be good to know.

Example purescript-react-vite-starter

image

Suggestion

Here are some suggestions with different wording. If one of them and the change in general is okay, I could open a pull request.

Spago failed to find esbuild, but bundling an PureScript code requires esbuild to be installed. See https://esbuild.github.io/getting-started/#install-esbuild for ways to install esbuild.

Spago was unable to find esbuild, yet esbuild must be installed in order to bundle PureScript code. See https://esbuild.github.io/getting-started/#install-esbuild for ways to install esbuild.

Failed to find esbuild. Spago relies on esbuild to bundle code. See https://esbuild.github.io/getting-started/#install-esbuild for ways to install esbuild.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/Spago/Build.hs around line 452, where the missing esbuild error is reported. Review how spago bundle-app reaches this message and update it to identify Spago and explain that esbuild is needed for bundling. Verify the revised wording when esbuild is unavailable, including the installation link.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.