Skip to content
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

[2.7.x] Functional components don't compile properly #12625

Closed
Tofandel opened this issue Jul 6, 2022 · 0 comments
Closed

[2.7.x] Functional components don't compile properly #12625

Tofandel opened this issue Jul 6, 2022 · 0 comments

Comments

@Tofandel
Copy link

Tofandel commented Jul 6, 2022

Version

2.7.3

Reproduction link

github.com/Tofandel/vue-bug

(That issue cannot be reproduced on codesandbox)

Steps to reproduce

Use a functional component with both a static part and a dynamic part on vue 2.7.x

You can clone the reproduction, run yarn install and yarn serve
The page is not rendered, look at the error in the console

What is expected?

No error to be thrown

What is actually happening?

[Vue warn]: Error in render: "TypeError: _c is not a function"


I recently upgraded from 2.6.14 to 2.7.3

In vue 2.6.14

<template functional>
  <div :class="classes">
    <p>{{str}}</p>
    <span><a>Hi bug</a></span>
  </div>
</template>

<script>
export default {
  props: {
    classes: null,
    str: String
  }
}
</script>

Used to compile to:

var render = function (_h, _vm) {
    var _c = _vm._c
    return _c("div", {class: _vm.classes}, [
        _c("p", [_vm._v(_vm._s(_vm.str))]),
        _vm._m(0),
    ])
};
var staticRenderFns = [
    function (_h, _vm) {
        var _c = _vm._c
        return _c("span", [_c("a", [_vm._v("Hi bug")])])
    }
];

On vue 2.7.3 it compiles to:

var render = function render(_c, _vm) {
    return _c("div", {
        class: _vm.classes
    }, [_c("p", [_vm._v(_vm._s(_vm.str))]), _vm._m(0)]);
};
var staticRenderFns = [function (_c, _vm) {
    return _c("span", [_c("a", [_vm._v("Hi bug")])]);
}];

The first parameter of staticRenderFns is always null on both version, so it does seem obvious there is an issue in the compilation

@Tofandel Tofandel changed the title Functional components don't compile properly [2.7.x] Functional components don't compile properly Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant