shikijs / twoslash

You take some Shiki, add a hint of TypeScript compiler, and 🎉 incredible static code samples
https://shikijs.github.io/twoslash/
MIT License
1.06k stars 51 forks source link

11ty plugin is not practical to use #175

Open robole opened 1 year ago

robole commented 1 year ago

Hi,

Thanks for your great work!

At the moment, the 11ty plugin is not practical to use. I am currently migrating a website to 11ty with 100 pages and the build time is 1.5seconds, with incremental builds a file change reloads in milliseconds. If I add the twoslash plugin, it pushes the build time to 8 seconds, and incremental builds take the same time. Having that as a dev mode experience is too painful.

The issue is clear, twoslash needs to run async and 11ty does not permit this behavior. I made a feature request with 11ty to enable plugins to be async. You can upvote that issue to help resolve this bottleneck.

orta commented 1 year ago

That's pretty wild - there's result caching inside shiki-twoslash which might not be happening for some reason? (It's been a long time since I've looked in the code) which should just cache all the twoslash work, but still run the syntax highlighter at runtime. This was enough to make it usable on the place I was using it.