script-setup ignores imports with a dollar $
Version
3.2.0-beta.8
Reproduction link
https://github.com/jods4/bug-vue-dollar
Steps to reproduce
import { v$Hello } from "./something"
If you bind v$Hello
in template it won't be there, Vue removed it as if it was unused.
This can't be seen in SFC playground because the build codegen is different, so look at the linked repository instead.
What is expected?
v$Hello is exported by setup and bound in template.
What is actually happening?
v$Hello is not exported by setup.
Renaming the import works, also demonstrated in linked repo: import { v$Hello as vHello }
does work.
Notice this isn't a directive, even though it starts with v
. As vHello
shows, this doesn't seem to be a problem for the compiler.
@jods4
Are you sure this is a problem with version 3.2.0-beta.8
?
@lidlanca
I noticed that your PR is checkout from the master branch, not v3.2
.
because v3.2
not contains this code
let isUsedInTemplate = true
if (isTS && sfc.template && !sfc.template.src) {
isUsedInTemplate = new RegExp(`\\b${local}\\b`).test(
resolveTemplateUsageCheckString(sfc)
)
}
@edison1105 you are correct, 3.2 does not have this
but the v3.2.0-beta.8
tag and master does.