-
Notifications
You must be signed in to change notification settings - Fork 344
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
error Cannot read property 'silent' of undefined #564
Comments
Did you install the plugin via? Vue.use(VueCompositionAPI) |
Definitely set it up. |
Can you share a minimal reproduce repo or CodeSandbox? Thanks. |
As I was preparing CodeSandbox, I found that I had indeed referenced the file before Vue.use(VueCompositionAPI). Therefore, mistakes will be reported. The order in which composition-api/src/reactivity/reactive.ts Line 202 in 5b1b094
composition-api/src/reactivity/reactive.ts Line 217 in 5b1b094
composition-api/src/reactivity/reactive.ts Line 101 in 5b1b094
Get the vue instance here. composition-api/src/runtimeContext.ts Line 39 in 3a1d992
Since there is no registration, vueConstructor is nulluse the default. vueDependency
composition-api/src/reactivity/reactive.ts Line 218 in 5b1b094
composition-api/src/reactivity/reactive.ts Lines 25 to 32 in 5b1b094
composition-api/src/utils/helper.ts Lines 29 to 31 in 5b1b094
The check is only verified when it is run here. Why didn't my project run here? I compared my project to CodeSandbox. Discover that the vue version of that I use in my project is CodeSandbox use I feel like there's something wrong here. composition-api/src/runtimeContext.ts Line 8 in 3a1d992
Thank you for your review. |
you may have a point there with the last line. Maybe we don't properly handle he moduleinterop default export. try {
vueDependency = require('vue')
if (typeof vueDependency !== 'function' && vueDependency.default) {
vueDependency = vueDependency.default
}
} catch {
// not available
} @antfu thoughts? |
@LinusBorg Exactly going to do this! Is there any reason to check if it's a function, or are you meant to be check if it's |
I think is just to make sure that |
Yep. if its a function we already have the default export - the Vue Constructor. If it's not, we have an object with the Vue constructor in the |
Co-authored-by: Javier Pérez <[email protected]>
I'm having a problem with it.
My project is in esm mode, so I use @vue/compostition-api esm version of the code.
I define the following code.
I got an error.
![image](https://user-images.githubusercontent.com/8925282/96207299-77da2800-0f9d-11eb-8bc9-f1c34389fe2e.png)
![image](https://user-images.githubusercontent.com/8925282/96207238-4eb99780-0f9d-11eb-86e2-1e24e8af75a7.png)
When I debugger.
composition-api/src/runtimeContext.ts
Line 8 in 3a1d992
composition-api/src/runtimeContext.ts
Line 39 in 3a1d992
vueConstructor
is nullvueDependency
is {default: ...}Whether
vueDependency
should be dealt with. or useimport
, let babel or webpack handle it.Or there is a problem with my project configuration.
How it needs to be configured.
The text was updated successfully, but these errors were encountered: