fix(sfc): allow variables that start with _ or $ in <script setup>

This commit is contained in:
Evan You
2021-06-23 10:13:23 -04:00
parent 63e9e2e9aa
commit 0b8b576428
4 changed files with 65 additions and 70 deletions

View File

@@ -946,7 +946,9 @@ export function compileScript(
allBindings[key] = true
}
}
returned = `{ ${Object.keys(allBindings).join(', ')} }`
returned = `{ ${Object.keys(allBindings).join(', ')}${
__TEST__ ? `` : `, __isScriptSetup: true`
} }`
}
s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`)