vue3 auto imports from "vue/dist/vue" instead of "vue"

I have recently stated using vue3 with WebStorm 2021.3.2.  I used vue-cli to create the project.   When I use a vue method WebStorm knows to add an import to the top of the script section.   However it adds the wrong path.  It is adding import {method} from "vue/dist/vue"   this fails.   The path I need it to use is simply import {method} from "vue".    I have spent a while trying to fix this. Can anyone help me change this?  Any assistance would be welcome.

1
6 comments

please could you share a code snippet (as text) the issue can be reproduced with? Can you repeat it in a new project?

0

Can second this, happens in several unrelated projects and is quite irritating as it prevents a successful build. 

Iirc it mainly occurs when pasting code from another file, even when the correct import is already used in the file...

0

Same issue here. Happening with several unrelated projects as well.

0

Can't reproduce

Please share a test project (including .idea folder) the issue can be repeated with

0

This is the project:
https://github.com/betoop/vite-project-4445444141970

It was created through `pnpm create vite` as a regular vue project.

Worths to mention I'm using `pnpm`. Same occurs with `npm`. haven't tested on `yarn`.

To reproduce the issue:

  1. Go to `src/composables/useSomething.ts`
  2. Select Line 4 and copy it.
  3. Go to `src/components/HelloWorld.vue`
  4. Paste it anywhere inside the `<script setup>` tags
  5. `import { computed } from "vue/dist/vue";` gets added 

 

0

Please sign in to leave a comment.