-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unresolved global directive leads to the Cannot read properties of undefined (reading 'deep')
error
#6340
Comments
cexbrayat
added a commit
to cexbrayat/vue-next
that referenced
this issue
Sep 15, 2022
Fixes vuejs#6340 This commit improves the case when a directive is not found in a template. As `resolveDirective` returns `undefined`, some code was failing with the following error: ``` TypeError: Cannot read properties of undefined (reading 'deep') ```
cexbrayat
added a commit
to cexbrayat/vue-next
that referenced
this issue
Oct 6, 2022
Fixes vuejs#6340 This commit improves the case when a directive is not found in a template. As `resolveDirective` returns `undefined`, some code was failing with the following error: ``` TypeError: Cannot read properties of undefined (reading 'deep') ```
yyx990803
pushed a commit
that referenced
this issue
Nov 8, 2022
fix #6340 This commit improves the case when a directive is not found in a template. As `resolveDirective` returns `undefined`, some code was failing with the following error: ``` TypeError: Cannot read properties of undefined (reading 'deep') ```
chrislone
pushed a commit
to chrislone/core
that referenced
this issue
Feb 4, 2023
fix vuejs#6340 This commit improves the case when a directive is not found in a template. As `resolveDirective` returns `undefined`, some code was failing with the following error: ``` TypeError: Cannot read properties of undefined (reading 'deep') ```
zhangzhonghe
pushed a commit
to zhangzhonghe/core
that referenced
this issue
Apr 12, 2023
fix vuejs#6340 This commit improves the case when a directive is not found in a template. As `resolveDirective` returns `undefined`, some code was failing with the following error: ``` TypeError: Cannot read properties of undefined (reading 'deep') ```
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Vue version
3.2.73
Link to minimal reproduction
https://sfc.vuejs.org/#eNo9jUkOwjAMRa8SeU2SfRUhcY9sCjWQqhlku2FR5e4kCHVn/+H9A26lmLojTOAEY9lmwatPSrklVFV1yqIJOW8VF2W74+wZgwuEWDKJjnMxK+fUKcco+7/BHib1U4bWZ8bv4S1SeLKWn4+xvbLJ9LL9MrQnCRENctR3yh9G6mAPA9F8atC+EZ887A==
Steps to reproduce
Add any nonexistent custom directive to any element in the SFC file.
What is expected?
An error with a correct message about unresolved directive.
What is actually happening?
You can see a warning
Failed to resolve directive: not-resolved
in the logs but thenCannot read properties of undefined (reading 'deep')
error is thrown at this line:core/packages/runtime-core/src/directives.ts
Line 104 in ea6fc84
Problem is that SFC compiler generates something like this:
resolveDirective
tries to resolve directive, can't find it, writes a warning to the logs and returnsundefined
. Then functionwithDirectives
fails because it is assuming that all directives are correctly resolved.This issue is also related to #4054 -
resolveDirective
really returnsDirective | undefined
andwithDirectives
expectsdirectives: Array<[Directive, ...]>
.System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: