Open
Description
Describe the bug
Title. This is problematic when it comes to debugging top level exceptions, as one would see TypeError: err.message is undefined
instead of the actual error if the module throws an object that doesn't have a message: string
property defined.
Relevant code:
vite/packages/vite/src/shared/hmr.ts
Lines 277 to 281 in 262b5ec
vite/packages/vite/src/shared/hmr.ts
Lines 226 to 228 in 262b5ec
Reproduction
https://stackblitz.com/edit/vitejs-vite-9ucejjv8?file=src%2FApp.jsx
Steps to reproduce
- Launch the app
- Wait for 'ok' to show up
- Uncomment
throw 'error';
inApp.jsx
- Check console
Current:
> Uncaught (in promise) TypeError: err.message is undefined
warnFailedUpdate client:163
...
Expected:
> [vite] error
> [vite] Failed to reload /src/App.jsx. This could be due to syntax errors or importing non-existent modules. (see errors above)
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.20.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@vitejs/plugin-react: ^4.3.4 => 4.3.4
vite: ^6.2.2 => 6.2.2
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.