wxt icon indicating copy to clipboard operation
wxt copied to clipboard

feat: tolerate module resolution errors on startup

Open aleclarson opened this issue 8 months ago • 5 comments
trafficstars

Overview

Avoid crashing the dev server if a broken import exists.

Screenshot 2025-03-21 at 13 53 12

Unrelated to this PR: You can see the suggestion to install vite-tsconfig-paths, but as I understand it, WXT doesn't recommend using that package; preferring that the user sets alias in wxt.config.ts instead.

Manual Testing

  1. Introduce a broken import statement
  2. Start the dev server

aleclarson avatar Mar 21 '25 18:03 aleclarson

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
Latest commit fdd9eb3b7dbfe56e5b55208b3b15c4e01f006593
Latest deploy log https://app.netlify.com/sites/creative-fairy-df92c4/deploys/67f56bc0cd7ac20008be8d69
Deploy Preview https://deploy-preview-1529--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.

netlify[bot] avatar Mar 21 '25 18:03 netlify[bot]

Do not merge yet. Looking into import errors coming from Vite's load fallback...

aleclarson avatar Mar 21 '25 18:03 aleclarson

~~Still not ready. Handling the Rollup failed to resolve import error now!~~

Okay, should be ready for review! @aklinker1

aleclarson avatar Mar 21 '25 19:03 aleclarson

@aklinker1 I updated existing tests for detectDevChanges. I wasn't sure what the test for the new errorFiles argument should look like, so I created a stub for you to fill out.

And we should definintely add tests for this function (resolveErrorFiles). Will be nice to have example errors we can refer to to understand what exactly what is happening better.

Do you mean unit tests with dummy errors resembling real ones, or are you asking for integration tests that reproduce the errors using Babel, Rollup, Vite, etc?

aleclarson avatar Apr 08 '25 18:04 aleclarson

Do you mean unit tests with dummy errors resembling real ones, or are you asking for integration tests that reproduce the errors using Babel, Rollup, Vite, etc?

I was just taking about unit tests, but integration tests would probably be better for this.

aklinker1 avatar Apr 09 '25 15:04 aklinker1