vite-plugin-vue icon indicating copy to clipboard operation
vite-plugin-vue copied to clipboard

用ts开发单页面组件,script标签上如果用了src属性,会导致模版中的ts不编译

Open wuchen092832 opened this issue 2 years ago • 0 comments

Related plugins

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

wuchen092832 avatar Feb 14 '23 09:02 wuchen092832