language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

vue-tsc CLI reports errors on clean VitePress .md files

Open cha-hin opened this issue 1 year ago • 0 comments

Vue - Official extension or vue-tsc version

2.2.8

VSCode version

1.98.2

Vue version

3.5.13

TypeScript version

5.7.2

System Info

System:
  OS: macOS 15.3.2
  CPU: (12) arm64 Apple M2 Pro
  Memory: 66.97 MB / 16.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 22.13.0 - ~/.nvm/versions/node/v22.13.0/bin/node
  Yarn: 1.22.22 - ~/.yarn/bin/yarn
  npm: 11.2.0 - ~/.nvm/versions/node/v22.13.0/bin/npm
  pnpm: 9.15.4 - ~/Library/pnpm/pnpm
  bun: 1.0.26 - ~/.bun/bin/bun
  Watchman: 2025.02.17.00 - /opt/homebrew/bin/watchman
Browsers:
  Chrome: 134.0.6998.166
  Safari: 18.3.1
  Safari Technology Preview: 18.4

package.json dependencies

{
  "dependencies": {
    "vue": "^3.5.13"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.2.1",
    "@vue/tsconfig": "^0.7.0",
    "typescript": "~5.7.2",
    "vite": "^6.2.0",
    "vitepress": "^1.6.3",
    "vue-tsc": "^2.2.4"
  }
}

Steps to reproduce

Install and set up VitePress

  • Install VitePress in your vue project.
  • Run npx vitepress init
  • Answer the questions as described in this picture: Image

Enable IntelliSence support in VS Code (c.f. the docs for details)

Open your tsconfig.json file and replace the content with the following:

{
  "extends": "@vue/tsconfig/tsconfig.dom.json",
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "docs/**/*.ts",
    "docs/**/*.vue",
    "docs/**/*.md"
  ],
  "vueCompilerOptions": {
    "vitePressExtensions": [".md"]
  }
}

Run the following command

./node_modules/.bin/vue-tsc --noEmit

You should observe the following errors in the console output:

Unable to resolve embedded: template -> template_inline_css
Unable to resolve embedded: template -> template_inline_ts_0
Unable to resolve embedded: template -> template_inline_ts_1
Unable to resolve embedded: template -> template_inline_ts_2
Unable to resolve embedded: template -> template_inline_css
Unable to resolve embedded: template -> template_inline_css

What is expected?

I expect that running the command vue-tsc --noEmit should not produce any warnings or errors when checking VitePress .md files, when these files don’t contain any issues.

What is actually happening?

The command vue-tsc --noEmit generates the following errors in the console output:

Unable to resolve embedded: template -> template_inline_css
Unable to resolve embedded: template -> template_inline_ts_0
Unable to resolve embedded: template -> template_inline_ts_1
Unable to resolve embedded: template -> template_inline_ts_2
Unable to resolve embedded: template -> template_inline_css
Unable to resolve embedded: template -> template_inline_css

Link to minimal reproduction

https://github.com/chahin-repros/vitepress-issue-repro

Any additional comments?

I installed and set up VitePress in my project.

I followed the docs to enable IntelliSence support in VS Code.

I'm using vue-tsc to perform type checking from the command line. My tsconfig file directly affects how vue-tsc behaves.

After enabling IntelliSense, running the command to type-check my source code (including VitePress-related files) now produces the following error(s):

Console output snippet:

$ vue-tsc --noEmit

Unable to resolve embedded: template -> template_inline_css
Unable to resolve embedded: template -> template_inline_ts_0
Unable to resolve embedded: template -> template_inline_ts_1
Unable to resolve embedded: template -> template_inline_ts_2
Unable to resolve embedded: template -> template_inline_css
Unable to resolve embedded: template -> template_inline_css

These errors appear only when the following options are included in the tsconfig file:

{
  "include": [
    "docs/**/*.ts",
    "docs/**/*.vue",
    "docs/**/*.md", // <-- this line
  ],
  "vueCompilerOptions": {
    "vitePressExtensions": [".md"], // <-- this line
  },
}

cha-hin avatar Apr 01 '25 14:04 cha-hin