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

feat: tolerate syntax errors #1437

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

Conversation

aleclarson
Copy link
Contributor

@aleclarson aleclarson commented Feb 15, 2025

Overview

Avoid crashing the dev server on syntax errors.

NOTE: Only syntax errors from the Babel parser are supported currently. We should also handle any other common parsers.

Manual Testing

Two cases are handled by this PR:

  • Starting the dev server with a syntax error in an entrypoint.
  • Saving an entrypoint after introducing a new syntax error.

In both cases, WXT currently crashes and you need to restart it manually.

With this PR, both cases are logged (including filename and location of the syntax error). When the offending file is fixed, the dev server continues like nothing ever happened. 🎉

Screenshots

Syntax error on dev server startup

Screenshot 2025-02-14 at 21 11 55

After fixing the syntax error

Screenshot 2025-02-14 at 21 12 23

Related Issue

Closes #1297

Copy link

netlify bot commented Feb 15, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 74265e1
🔍 Latest deploy log https://app.netlify.com/sites/creative-fairy-df92c4/deploys/67aff927f6198c0008d06f1c
😎 Deploy Preview https://deploy-preview-1437--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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.

Babel Parser crash when there's a syntax error in content script
1 participant