Skip to content

Deno's Vue template is broken and typescript checking/linting doesn't work for .Vue files #30977

@sigmaxipi

Description

@sigmaxipi

Version: Deno 2.5.4
Follow the steps at https://docs.deno.com/examples/vue_tutorial/

  1. deno run -A npm:create-vite
  2. Use Vue and Typescript.
  3. deno install
  4. deno task dev works as expected.

However:
deno task build fails with

> deno task build
Task build vue-tsc -b && vite build
src/main.ts:3:17 - error TS2307: Cannot find module './App.vue' or its corresponding type declarations.

3 import App from './App.vue'
                  ~~~~~~~~~~~
Found 1 error.

To fix this, create src/vite-env.d.ts with

/// <reference types="vite/client" />

declare module '*.vue' {
  import type { DefineComponent } from 'vue'
  const component: DefineComponent<{}, {}, any>
  export default component
}

Then deno task build creates a proper build at dist as expected and deno task preview works.

However:
Introduce a basic error (const foo = bar;) or a subtle lint issue in src/App.vue such as an unread variable. The deno task build command says it run vue-tsc -b && vite build but it fails to pick up issues in src/App.vue. Running npx vue-tsc -b directly does detect these issues.

One thing I noticed is that node_modules/.tmp/tsconfig.app.tsbuildinfo says {"root":["../../src/App.vue","../../src/main.ts","../../src/vite-env.d.ts"],"version":"5.9.3"} so it's missing the App.vue file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions