Error handler info parameter is number in production (string in types)
Vue version
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-3ux5cf?file=src/main.js
Steps to reproduce
https://vuejs.org/api/application.html#app-config-errorhandler says the info
parameter is a string.
From reproduction link:
- run
vite build
to build production version - run
vite preview
- look at the console -> it says
error info: 0
, which is a number, but should be a string
From stratch
- attach global error handler in the app and log the info into console there
- add some purposeful error into any vue file
- build the app for production
- run the app and look at the console
What is expected?
Either the type should be a string|number, or the runtime version should give a string info
What is actually happening?
type of info
is string in developement and number
in runtime.
System Info
No response
Any additional comments?
No response
The strings are replaced with const enum numbers in production builds to reduce bundle size. You can check the corresponding full message here: https://github.com/vuejs/core/blob/main/packages/runtime-core/src/errorHandling.ts#L42-L59
We should document this behavior.