unovue / shadcn-vue

Vue port of shadcn-ui
https://www.shadcn-vue.com/
MIT License
4.89k stars 280 forks source link

[Bug]: Failed to resolve import "'radix-vue'" #128

Closed demiro closed 1 year ago

demiro commented 1 year ago

Environment

Developement/Production OS: Windows 10 19043.1110
Node version: 18.x.0
Package manager: pnpm@8.6.0

Link to minimal reproduction

/

Steps to reproduce

Describe the bug

After installing first component(s) I am getting

[plugin:vite:import-analysis] Failed to resolve import "'radix-vue'" from "src\components\ui\dropdown-menu\index.ts". Does the file exist?

Checked the documentation if I missed the step installing a dependency, but haven't seen any reference to radix-vue. But after examining package.json, it was there...

and then I double check the error, and it is clear, there are doulbe quotes along with single quotes in the index.ts file:

export { DropdownMenuPortal } from "'radix-vue'"

export { default as DropdownMenu } from "'./DropdownMenu.vue'"
export { default as DropdownMenuTrigger } from "'./DropdownMenuTrigger.vue'"
export { default as DropdownMenuContent } from "'./DropdownMenuContent.vue'"
export { default as DropdownMenuGroup } from "'./DropdownMenuGroup.vue'"
export { default as DropdownMenuRadioGroup } from "'./DropdownMenuRadioGroup.vue'"
export { default as DropdownMenuItem } from "'./DropdownMenuItem.vue'"
export { default as DropdownMenuCheckboxItem } from "'./DropdownMenuCheckboxItem.vue'"
export { default as DropdownMenuRadioItem } from "'./DropdownMenuRadioItem.vue'"
export { default as DropdownMenuShortcut } from "'./DropdownMenuShortcut.vue'"
export { default as DropdownMenuSeparator } from "'./DropdownMenuSeparator.vue'"
export { default as DropdownMenuLabel } from "'./DropdownMenuLabel.vue'"
export { default as DropdownMenuSub } from "'./DropdownMenuSub.vue'"
export { default as DropdownMenuSubTrigger } from "'./DropdownMenuSubTrigger.vue'"
export { default as DropdownMenuSubContent } from "'./DropdownMenuSubContent.vue'"

Expected behavior

use double quotes or single quotes... not both

Conext & Screenshots (if applicable)

No response

demiro commented 1 year ago

I repeats in all the imports, all the components added... and in the code (cn function) as well for example:

<script setup lang="ts">
import {
  DropdownMenuSubTrigger,
  type DropdownMenuSubTriggerProps,
} from "'radix-vue'"
import { ChevronRight } from "'lucide-vue-next'"
import { cn } from "@/lib/utils"

const props = defineProps<DropdownMenuSubTriggerProps & { class?: string }>()
</script>

<template>
  <DropdownMenuSubTrigger
    v-bind="props"
    :class="["
    cn( "'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-slate-100 data-[state=open]:bg-accent' dark:focus:bg-slate-800"
    ,
    props.class,
    ),
    ]"">
    <slot />
    <ChevronRight class="ml-auto h-4 w-4" />
  </DropdownMenuSubTrigger>
</template>
zernonia commented 1 year ago

duplicated of https://github.com/radix-vue/shadcn-vue/issues/98

demiro commented 1 year ago

Are you using Vue without TypeScript?

of course not... using it with vite and typescript