vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.21k stars 2.13k forks source link

shiki language lazy loading not working with twoslash #4334

Closed kravetsone closed 2 weeks ago

kravetsone commented 2 weeks ago

Describe the bug

I wants to build my documentation with bunx vitepress build docs (running in node) but it fails with [vitepress] Languagejsnot found, you may need to load it first

Solved by downgrading to 1.4.2

Repository

CICD logs

Reproduction

https://github.com/gramiojs/documentation/commit/561ce311bbcaf448b716e28a3b412f8a37966a2f

Expected behavior

Should work

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 7700 8-Core Processor
    Memory: 1.36 GB / 31.15 GB
  Binaries:
    Node: 22.10.0 - ~\AppData\Local\fnm_multishells\639520_1730573241452\node.EXE
    npm: 10.9.0 - ~\AppData\Local\fnm_multishells\639520_1730573241452\npm.CMD
    bun: 1.1.34 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (130.0.2849.46)
  npmPackages:
    vitepress: ^1.4.3 => 1.4.3

Additional context

No response

Validations

brc-dd commented 2 weeks ago

Hmm, twoslash is causing issues with lazy loading, but even if I disable it, curl and tree are causing issues. I don't see any language file for those. Weird.

Edit: Ah, curl and tree aren't even there in shiki, resolveLang should've return a falsy value for those. -- fixed this in dcb8450

brc-dd commented 2 weeks ago

Pushed a temporary patch in v1.4.4. Keeping the issue open though.

brc-dd commented 2 weeks ago

Should work fine with 1.4.5