esbuild-plugins icon indicating copy to clipboard operation
esbuild-plugins copied to clipboard

Difficulty seeing errors in esbuild-plugin-livereload

Open ryanb opened this issue 1 year ago • 2 comments

The livereload plugin has a great looking error overlay but I had difficulty getting it to work. After a bit of debugging I noticed that forceReload was true causing the reload to happen before the error could be shown. This was true because write: true needed to be set on my esbuild config. A few ideas to make this more intuitive.

  1. Isn't write enabled by default in esbuild? Perhaps if write is undefined it shouldn't force reload.
  2. The plugin states "write" option is disabled, so CSS updates will trigger a full reload which I ignored since I wasn't working with CSS. It appears this affects JS only changes too?
  3. Currently msg.errors?.length check is done at the end of thechange event. What do you think about doing it at the beginning? And then return early if there are errors so we can see them even if forceReload is true. I always want to see errors.

Thanks for the awesome plugin!

ryanb avatar Oct 30 '24 17:10 ryanb

Hi! Sorry for the long response delay on this, I was insanely busy late last year.

I think your ideas could make a lot of sense. Would you be open to contributing them? I won't have time to do more than basic dependency upgrades on these projects for the foreseeable future.

jgoz avatar Feb 13 '25 18:02 jgoz

@jgoz thanks for the response. I understand about being busy! I'll try to take a look at submitting a PR for this some day. I got it working as-is in my current project so I don't have a pressing need. 😄

ryanb avatar Feb 13 '25 18:02 ryanb