vite-plugin-vue
vite-plugin-vue copied to clipboard
用ts开发单页面组件,script标签上如果用了src属性,会导致模版中的ts不编译
Related plugins
-
[X] plugin-vue
-
[ ] plugin-vue-jsx
Describe the bug
<template>
<div class="main">
<p v-if="type as string">hello</p>
</div>
</template>
<style scoped lang="scss"></style>
<script lang="ts" src="./app.ts"></script>
上面的代码模版中的as string不会转成js,导致开发调试控制台报错SyntaxError: Unexpected identifier 'as'
Reproduction
https://stackblitz.com/edit/vitejs-vite-ow1rvx?file=src/App.vue
Steps to reproduce
No response
System Info
System:
OS: macOS 12.5
CPU: (8) x64 Apple M2
Memory: 19.51 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.0 - ~/Documents/node-v16.17.0-darwin-x64/bin/node
Yarn: 1.22.19 - ~/Documents/node-v16.17.0-darwin-x64/bin/yarn
npm: 8.15.0 - ~/Documents/node-v16.17.0-darwin-x64/bin/npm
Browsers:
Chrome: 109.0.5414.119
Safari: 15.6
Used Package Manager
yarn
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] 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 vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.