Eleventy plugin not working
See original GitHub issueHello,
I’m trying to run this within 11ty but haven’t gotten past the setup part, as the plugin errors out with Could not get Shiki loaded async via 'deasync'
Minimal reproduction: https://replit.com/@dpfavand/11ty-shiki-twoslash-doesnt-work (click the green button to run).
It appears that the setupForFile
promise is never resolved or rejected. But that’s about as far as I have been able to get.
Node 14 and 12
Eleventy 12.1
eleventy-plugin-shiki-twoslash 1.0.7
Has anyone else run into this lately? Running on Node 12 and 14, both promises and async should be available, so I’m not sure what’s going on.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Plugins — Eleventy
Serverless : A plugin to run Eleventy in a serverless function for server side rendering (e.g. Previews in your CMS) and/or in very...
Read more >@lit-labs/eleventy-plugin-lit - npm
Eleventy plugin for rendering Lit components.. Latest version: 0.2.3, last published: 4 ... Roadmap; Issues and comments; Contributing ...
Read more >First Experience Building with Eleventy's WebC Plugin
My first attempt working with Eleventy's new Web Component plugin. ... down - running our web components during server build and not on...
Read more >@11ty/eleventy-plugin-syntaxhighlight - npm package | Snyk
The npm package @11ty/eleventy-plugin-syntaxhighlight was scanned for known vulnerabilities and missing license, and no issues were found.
Read more >The new Eleventy Vite Plugin—Eleventy Weekly №5 (2022 ...
Eleventy Dev Server: https://www.11ty.dev/docs/watch-serve/# eleventy -dev-server* Add a 404 Not Found Page to Eleventy ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update here. I don’t think it is possible. To override the default behavior of older markdown-it, we need to get access to the
MarkdownIt()
instance, which in our case isthis.mdLib
from the eleventy’s markdown engine, which I don’t think is possible to access through the config object, which is the only thing we have access to.Long sentence short, even the official syntax highlighters use this weird syntax to highlight lines because it’s impossible to get attributes other than the first one.
Yes, PRs are welcomed, and thanks.
Thanks for checking the example. I’ve been doing some more testing, and seem to have gotten past that error and run into another. So I don’t think it was hardware constraints - it’s even stranger.
My local machine is WSL Ubuntu with Node 14 and 15 (via nvm).
I’m using your example repo and mine.
Notes
First test: Node 12 vs 14 vs 15
Locally I tested 14 and 15, and used 12 in the replit. Node 15 worked, but 12 and 14 didn’t. This was disappointing because 14 is LTS and I was hoping this library would work on Node LTS. However, then I tested something else - the Eleventy build command.
npx @11ty/eleventy
vseleventy
I noticed that my initial build command followed the current Eleventy getting started guide:
npx @11ty/eleventy
. I set this as thebuild
script in mypackage.json
. On a whim I swapped it out for a more traditionaleleventy
command. And it worked! On both my local Node 14 and Replit’s Node 12. Mostly…New error:
Cannot read property 'split' of undefined
Although calling the build process through
eleventy
rather thannpx @11ty/eleventy
got past the async load error in my original issue, my repository runs into a different error,Cannot read property 'split' of undefined
at https://github.com/shikijs/twoslash/blob/main/packages/remark-shiki-twoslash/src/index.ts#L35 - it appears thatmetaString
is undefined at that point.This occurs on my example in Node 12 and 14, but not in your example on Node 14. Your example also uses what I think is an old canary version of Eleventy. I tested changing your example to Eleventy 0.12.1 and it shows the same error, on both Node 14 and 15.
Conclusions
npx @11ty/eleventy
behaves differently than callingeleventy
directly on Node 14. I don’t understand why, but basically on Node 12 and 14 you cannot build usingnpx @11ty/eleventy
when you have this plugin configured. Not a huge deal in the end but definitely confusing.metaString
issue. I will investigate further, perhaps the Eleventy plugin API changed since the canary version used in your example. If I find something I’ll post and/or try to make a PR.The Replit example linked above is updated and exhibits the same behavior as my local Node 14 and 15 environments using Eleventy 12.1.