question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Web Components with Functional child components throws "Cannot read property '$options' of undefined"

See original GitHub issue

Version

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

  1. Clone or fork repo at minimal reproduction link
  2. Run npm i in console
  3. Run npm run build-wc in console
  4. 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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sodateacommented, Apr 29, 2020

I’ll take a look later today or tomorrow.

1reaction
sodateacommented, May 1, 2020

Yeah I was testing some edge cases locally. Anyway, that PR works. I’m merging it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found