Web Components with Functional child components throws "Cannot read property '$options' of undefined"
See original GitHub issueVersion
3.8.0
Reproduction link
https://github.com/wpatter6/vue-wc-functional-bug
Environment info
Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
Binaries:
Node: 11.13.0 - C:\Program Files (x86)\Nodist\bin\node.EXE
Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.7.0 - C:\Users\william.patterson\AppData\Roaming\npm\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.0.0
@vue/babel-plugin-transform-vue-jsx: 1.0.0
@vue/babel-preset-app: 3.8.0
@vue/babel-preset-jsx: 1.0.0
@vue/babel-sugar-functional-vue: 1.0.0
@vue/babel-sugar-inject-h: 1.0.0
@vue/babel-sugar-v-model: 1.0.0
@vue/babel-sugar-v-on: 1.0.0
@vue/cli-overlay: 3.8.0
@vue/cli-plugin-babel: 3.6.0 => 3.6.0
@vue/cli-plugin-eslint: 3.6.0 => 3.6.0
@vue/cli-service: 3.8.0 => 3.8.0
@vue/cli-shared-utils: 3.8.0
@vue/component-compiler-utils: 2.6.0
@vue/preload-webpack-plugin: 1.1.0
@vue/web-component-wrapper: 1.2.0
eslint-plugin-vue: ^5.0.0 => 5.2.2
vue: 2.6.10 => 2.6.10
vue-eslint-parser: 2.0.3
vue-hot-reload-api: 2.3.3
vue-loader: 15.7.0
vue-style-loader: 4.1.2
vue-template-compiler: ^2.5.21 => 2.6.10
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
@vue/cli: Not Found
Steps to reproduce
- Clone or fork repo at minimal reproduction link
- Run npm i in console
- Run npm run build-wc in console
- Open dist/demo.html in browser
What is expected?
Web component should render properly with no errors in browser console
What is actually happening?
Component does not render, error message says
[Vue warn]: Error in render: "TypeError: Cannot read property '$options' of undefined"
found in
---> <App> at src/App.vue
<Root>
Here is the stack trace of the error in the console:
TypeError: Cannot read property '$options' of undefined
at FunctionalRenderContext.hook (v-app.js:704)
at renderWithStyleInjection (v-app.js:716)
at createFunctionalComponent (vue.js:3065)
at createComponent (vue.js:3238)
at _createElement (vue.js:3422)
at createElement (vue.js:3360)
at vm._c (vue.js:3491)
at Proxy.render (v-app.js:735)
at VueComponent.Vue._render (vue.js:3545)
at VueComponent.updateComponent (vue.js:4061)
If I make the child component non-functional it will work properly. Was really hoping to be able to use functional components to help improve performance of my web components.
Thanks in advance for any help!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Web Components with Functional child components throws ...
Web Components with Functional child components throws "Cannot read property ... TypeError: Cannot read property '$options' of undefined at ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Uncaught TypeError: Cannot read property 'apply' of ...
The issue was I was trying to call a function on the parent directly from the child and that doesn't work. You need...
Read more >TypeError: Cannot read property 'children' of undefined
js I have the main component that accepts 3 props.(SearchCountry, SearchedCountry and Datas): import React, { Component } from 'react'; ...
Read more >Use ES6 Arrow Functions to Resolve "TypeError - Pluralsight
If you run into this error while writing React, the odds are high that you are trying to use a function within another...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll take a look later today or tomorrow.
Yeah I was testing some edge cases locally. Anyway, that PR works. I’m merging it.