Skip to content

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

Closed
vuejs/vue-loader
#1560
@wpatter6

Description

@wpatter6

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions