[Memory Leak]: Vitepress builds incorporating @shikijs/vitepress-twoslash
crash with JavaScript heap out of memory errors
#796
Labels
help-wanted
Extra attention is needed
Validations
Describe the bug
Hello 👋 from the Effect-TS community :)
We have recently been experimenting with using different frameworks for building our documentation website. I decided to try building our documentation with Vitepress because of the native integration with Shiki Twoslash (via
@shikijs/vitepress-twoslash
), which we make extensive use of in our docs.However, when I attempt to build our documentation with Vitepress and Shiki Twoslash, I consistently receive a
JavaScript heap out of memory
error. I have attempted to increase the--max-old-space-size
to ~8GB and still encounter this issue.With Twoslash Integration
In my
.vitepress/config.ts
, if I remove thetransformerTwoslash
from themarkdown.codeTransformers
array, the build succeeds without issue in ~20 seconds.Without Twoslash Integration
Tracking issue with Vitepress: vuejs/vitepress#4242
Expected behavior
My expected behavior would be for Vitepress to be able to build our docs with Shiki Twoslash integrated without issue.
System Info
Additional context
I've included a script in the
package.json
that reduces the available NodeJS heap memory (to force an OOM earlier) and takes a heap snapshot right before an OOM error occurs in case that is useful for you folks.Reproduction
https://github.com/IMax153/vitepress-memory-leak-repro.git
Clone our docs experiment
Install dependencies
Attempt to build
Contributes
The text was updated successfully, but these errors were encountered: