For AI agents: the complete documentation index is available at https://heyq02.com/llms.txt, the full documentation bundle is available at https://heyq02.com/llms-full.txt, and this page is available as Markdown at https://heyq02.com/blog/posts/vue3-cannot-find-app-vue.md.
跳到主要内容

解决 npm init vue@next 报错 Cannot find module './App.vue'

预计阅读时间: 小于 1 分钟

打开创建后的 env.d.ts 文件,写入以下声明:

/// <reference types="vite/client" />
declare module '*.vue' {
  import type { DefineComponent } from 'vue'
  const component: DefineComponent<{}, {}, any>
  export default component
}