-
-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplication of imports (PartiallyEnd: #3632/scriptSetup.vue) #5110
Comments
Downgrading the VueJS extensions to Upgrading to the latest version, causes this issue. |
I'm not sure if I understand what you mean, could you provide a gif or video that reproduces the steps? |
@KazariEX Thanks for your reply. I do not have a screenrecoder app, but this happens:
<script setup lang="ts">
import NavDrawer from '@/components/Navigation/NavDrawer.vue'
import NavBar from '@/components/Navigation/NavBar.vue'
</script>
<template>
<div class="drawer">
<NavBar />
<NavDrawer />
</div>
</template>
<script setup lang="ts">
import NavBar from '@/components/Navigation/NavBar.vue' /* PartiallyEnd: #3632/scriptSetup.vue */
import NavDrawer from '@/components/Navigation/NavDrawer.vue'
import NavBar from '@/components/Navigation/NavBar.vue'
</script>
<template>
<div class="drawer">
<NavBar />
<NavDrawer />
</div>
</template> It seems to import the same component on it's own, in the previous version (2.1.10) it doesn't do this. |
I'm working with vscode, also met this problem when use extension v2.2.0, but need to downgrade it to v2.1.6 to fix the issue. import type { DescData } from '@arco-design/web-vue/es/descriptions/interface' hit save(ctrl + s) and then it becomes: import type { DescData } from '@arco-design/web-vue/es/descriptions/interface' /* PartiallyEnd: #3632/both.vue */
import type { DescData } from '@arco-design/web-vue/es/descriptions/interface' |
This happens when using prettier-plugin-organize-imports, without vscode, as well. See simonhaenisch/prettier-plugin-organize-imports#139 @KazariEX what more info do you need? Happy to help out. Downgrading vue-tsc alone fixes the issue. |
This is also how you can trigger this: <script setup lang="ts">
import AppLayout from '@/layouts/AppLayout.vue'
import { Head } from '@inertiajs/vue3' /* PartiallyEnd: #3632/scriptSetup.vue */
import { Head } from '@inertiajs/vue3'
</script>
<template>
<Head title="Home" />
<AppLayout>
<div class="container">foo</div>
</AppLayout>
</template> However, adding something after the imports 'fixes' the issue: <script setup lang="ts">
import AppLayout from '@/layouts/AppLayout.vue'
import { Head } from '@inertiajs/vue3'
const foo = 'bar';
</script>
<template>
<Head title="Home" />
<AppLayout>
<div class="container">foo</div>
</AppLayout>
</template> It seems to expects something after the imports? |
It seems that the same problem occurs not only in the TS project, but also when I use JS
|
Removing or modifying 'source.organizeImports' to 'never' can be corrected // Extension: ESLint
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit",
"source.organizeImports": "explicit" // remove it or modify it to "never"
}, |
Bumped into this today. This helped: "[vue]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "never",
"source.sortImports": "never",
}
}, |
Vue - Official extension or vue-tsc version
2.2.0
VSCode version
1.96.1
Vue version
3.5.13
TypeScript version
5.7.2
System Info
package.json dependencies
Steps to reproduce
What is expected?
Do not duplicate import
What is actually happening?
Link to minimal reproduction
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: