Description
Describe the bug
Having something like
:filter-by="[keyName as string ?? 'key', valueName as string ?? 'value']"
in a pug template is fine with volar, but vite doesn't seem to expect that kind of thing and compiles it to js as is
"filter-by": [$props.keyName as string ?? 'key', $props.valueName as string ?? 'value'],
which leads to some cryptic error messages like
SyntaxError: missing ] after element list
Reproduction
System Info
System:
OS: Windows 10 10.0.19042
CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
Memory: 1.32 GB / 15.75 GB
Binaries:
Node: 16.14.2
Yarn: 1.22.4
npm: 8.5.0
Browsers:
Edge: Spartan (44.19041.1023.0), Chromium (98.0.1108.62)
Internet Explorer: 11.0.19041.1
npmPackages:
@vitejs/plugin-vue: ^2.3.1 => 2.3.1
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.