Skip to content

Shiki warning: 290 instances have been created #15656

@ocavue

Description

@ocavue

Astro Info

Astro                    v6.0.0-beta.15
Node                     v24.11.1
System                   macOS (arm64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

N/A

Describe the Bug

pnpm run build

> astro build

19:53:44 [types] Generated 37ms
19:53:44 [build] output: "static"
19:53:44 [build] mode: "static"
19:53:44 [build] directory: /private/tmp/2026-02-25_19-41-37/shining-star/dist/
19:53:44 [build] Collecting build info...
19:53:44 [build] ✓ Completed in 64ms.
19:53:44 [build] Building static entrypoints...
19:53:46 [vite] ✓ built in 1.80s
19:53:46 [vite] ✓ built in 9ms
19:53:46 [build] Rearranging server assets...

 generating static routes
19:53:46   ├─ /astro-components/abap/index.html (+83ms)
19:53:46   ├─ /astro-components/ada/index.html (+10ms)
19:53:46   ├─ /astro-components/adoc/index.html (+18ms)
19:53:46   ├─ /astro-components/apache/index.html (+4ms)
19:53:46   ├─ /astro-components/apex/index.html (+6ms)
19:53:46   ├─ /astro-components/apl/index.html (+17ms)
19:53:46   ├─ /astro-components/applescript/index.html (+5ms)
19:53:46   ├─ /astro-components/ara/index.html (+3ms)
19:53:46   ├─ /astro-components/asciidoc/index.html (+18ms)
19:53:46   ├─ /astro-components/asm/index.html[Shiki] 10 instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call `highlighter.dispose()` to release unused instances.
 (+21ms)
.
.
.
.
.
.
.
19:53:48   ├─ /astro-components/zenscript/index.html (+1ms)
19:53:48   ├─ /astro-components/zig/index.html (+1ms)
19:53:48   ├─ /astro-components/zsh/index.html[Shiki] 290 instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call `highlighter.dispose()` to release unused instances.
 (+2ms)
19:53:48   ├─ /index.html (+1ms)
19:53:48 ✓ Completed in 2.09s.

What's the expected result?

No shiki warnings

Link to Minimal Reproducible Example

https://github.com/issueset/astro-shiki-langs-issue.git

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions