Skip to content

Optional Chaining Error with Babel #8861

@tkrause

Description

@tkrause

Version

2.5.17

Reproduction link

https://codesandbox.io/s/m674vkw2j

Steps to reproduce

Use the optional chaining operator in a template:

{{ user?.id }}

What is expected?

Output the users id in the template or blank for undefined

What is actually happening?

  • invalid expression: Unexpected token . in "\n " _s(user?.id) "\n " Raw expression: {{ user?.id }}

Optional chaining works just fine in the script section of a SFC Vue component but does not work in the template section.

For reference, this is in an Nuxt.js 2.0 project stock settings with the babel optional chaining plugin

Version is actually 15.4.2 with Vue 2.5.17

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions