question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module '/@/xxx' or its corresponding type declarations.Vetur(2307)

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ
  • I have tried restarting VS Code or running Vetur: Restart VLS

Info

  • Platform: macos
  • Vetur version: v.0.33.1
  • VS Code version: 1.55.2
  • vue version: 3.0.0

Problem

Reproducible Case

image image

cannot find module /@/xx on vite2 app.

// vitejs config
alias: {
        '/@': path.resolve(__dirname, 'src') 
      }

base on issue https://github.com/vuejs/vetur/issues/1896 and mr https://github.com/vuejs/vetur/pull/2525, but the error is still having

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
twknabcommented, Mar 3, 2022

Just wanted to add that in addition to updating tsconfig.json as described here, I also had to create a shims-vue.d.ts file (per StackOverflow thread) and place it in my root Vue directory.

Here’s the contents of the file:

declare module "*.vue" {
  import type { DefineComponent } from "vue";
  const component: DefineComponent<
    Record<string, unknown>,
    Record<string, unknown>,
    unknown
  >;
  export default component;
}

🥲

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module xxx · Issue #1896 · vuejs/vetur - GitHub
The error message "cannot find module 'components/models'" is ... Cannot find module '/@/service' or its corresponding type declarations. in ...
Read more >
Cannot find module '/@/xxx' or its corresponding ... - Issuehunt
Cannot find module '/@/xxx' or its corresponding type declarations.Vetur(2307) #2875 · I have searched through existing issues · I have read through docs...
Read more >
Ask Question - Stack Overflow
"Cannot find module './components/Navigation' or its corresponding type declarations (Vetur 2307).". I realized that this only happens when I ...
Read more >
cannot find module or its corresponding type declarations ...
In one of my TypeScript files I am importing a Vue component using this line: import KTUserMenu from "@/layout/header/partials/UserMenu.vue";. But it is ......
Read more >
Cannot find module 'xxx' or its corresponding type ... - CSDN博客
问题描述:Cannot find module 'store/index' or its corresponding type declarations.Vetur(2307)原因分析:以当前项目的上级目录为根目录, Vetur ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found