warnHandler not invoked prior to `app.mount()` due to null `stack` / `instance` reference
Version
3.2.27
Reproduction link
Steps to reproduce
- Note logs in console
- Note comment on line 11 of JS source
What is expected?
warnHandler
be invoked for all warnings, even if app is not yet instanced / mounted.
What is actually happening?
warnHandler
is skipped and internal warn handler runs.
Potentially related:
#4479
The warnHandler is meant to handle warnings from things happening in components, i.e. during render. it's not meant to catch this kind of warning, really. That's why it receives a vm as the second argument.
That makes sense, but I'd think that internal warn
's shouldn't be issued outside the scope of a component if that's the case. Having a warnHandler
override that doesn't override all uses of warn
seems unintuitive.
Would it be possible for warnHandler
to be invoked with alternative arguments in the case that a component instance is not yet spun up?
This also happens when rendering a component server-side using @vue/server-renderer
. How can we get the warnings during SSR to fail the request or at least print them in the browser?