Fix 'Failed to resolve import' crash during ssr
PR Checklist
Please check if your PR fulfills the following requirements:
- [ ] Tests for the changes have been added (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] infrastructure changes
- [ ] Other... Please describe:
What is the current behavior?
If during SSR a vite error is encountered (such as a module not existing after a rename), vinxi's import function will throw, leading to the dev server crashing instead of being shown on the error overlay.
What is the new behavior?
The error is now caught, the dev server no longer crashes, and the error is shown in the overlay.
When the module isn't found, lazyRoute will just return a no-op component so that the route can continue to resolve essentially as a no-op, since the error will surface itself in the Vite overlay anyway (not sure how to make it appear in the SS error overlay).
Other information
This solves at least part of https://github.com/nksaraf/vinxi/issues/119
🦋 Changeset detected
Latest commit: 2adc8f1e3213472adf8772edb135142137bc7067
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @solidjs/start | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR