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

Bun --watch flag issue #1694

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

jtenner
Copy link

@jtenner jtenner commented Feb 5, 2025

Hey! Thank you for this amazing software.

The only issue I had was an issue with bun when using the --watch flag.

When the compilation of a given module fails with a syntax error, it prevents the plugin from generating any more modules. This breaks the --watch flag features.

Instead of failing, it makes sense to catch the error, log it to stderr, and then use a previously cached version of that module.

Features added:

  • Bugfix: Prevent plugin from crashing
  • Bugfix: Report errors to console for end users

A few questions:

  1. Is there a specific coding style I should conform to? Or is this solution fine?
  2. How can we "test" this, or should we just accept that it can't be tested well?

To try it out locally:

  1. Install Bun
  2. Initialize a bun project bun init -y
  3. Add bunfig.toml with preload = ["./dist/bun-civet.mjs"]
  4. Create index.civet with Bun.write "./test.txt", "Hello world!"
  5. bun --watch index.civet
  6. Add a syntax error (like a bunch of ='s) and change the "Hello world!" string to something else
  7. Notice that ./text.txt remains unmodified
  8. Remove the syntax errors from index.civet
  9. Check ./text.txt for the corresponding changes

I'm very happy to help or make modifications.

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

Successfully merging this pull request may close these issues.

1 participant