Open
Description
Describe the bug
when i migrate my project from vue-cli to vite, i meet an unexpected problem!
vue component cannot be loaded correctly when data have some specific name
code is below:
<template>
<div>
<div>EXPORT ISSUES</div>
<div>{{ showData }}</div>
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
@Component({
name: 'ExportIssues',
})
export default class ExportIssues extends Vue {
fieldInfo = { default: [] };
showData = '';
exportType = 'xlsx';
get getter() {
return this.fieldInfo.default;
}
created() {
this.showData = 'loaded correctly';
}
}
</script>
created
method will not run.
if delete the line exportType = 'xlsx';
or the getter
method, this component will run correctly
I guess its a bug of the compiler. It reads the 'export', 'default' word and do something wrong.
Need your help!
将项目从VueCLI迁移到Vite时遇到了问题。代码如上文。当Vue组件有一个数据叫exportType
,一个getter中包含叫default
的取值时,这个组件无法正常运行,created
方法不执行。把exportType = 'xlsx';
那行或者getter
删掉就正常了。
猜测是编译器把export
和default
读到了一起,然后编译错了东西?
需要你的帮助!
Reproduction
https://stackblitz.com/edit/vitejs-vite-s1r7wy?file=src%2Fcomponents%2FExportIssues.vue
Steps to reproduce
No response
System Info
System:
OS: macOS 13.4.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 166.40 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn
npm: 7.10.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
Browsers:
Chrome: 116.0.5845.110
Safari: 16.5.2
npmPackages:
@vitejs/plugin-vue2: ^2.2.0 => 2.2.0
vite: 4.4.9 => 4.4.9
Used Package Manager
yarn
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 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.
Metadata
Assignees
Labels
No labels