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

NonErrorEmittedError on loading docusaurus docs #162

Open JJWTimmer opened 2 years ago

JJWTimmer commented 2 years ago

Hi,

I'm using latest Docusaurus 2 and the latest shiki-twoslash preset, and I loaded a custom grammar. I get the following output a few thousand times on our site:

ERROR in ./docs/CompileTimeErrors/AmbiguousFunctionReference/index.md

Module build failed (from ./node_modules/@docusaurus/mdx-loader/lib/index.js):
NonErrorEmittedError: (Emitted value instead of an instance of Error) {"error":1,"offset":0,"length":5}
    at processResult (C:\dev\projects\rascal\rascal-website\node_modules\webpack\lib\NormalModule.js:755:12)
    at C:\dev\projects\rascal\rascal-website\node_modules\webpack\lib\NormalModule.js:860:5
    at C:\dev\projects\rascal\rascal-website\node_modules\loader-runner\lib\LoaderRunner.js:399:11
    at C:\dev\projects\rascal\rascal-website\node_modules\loader-runner\lib\LoaderRunner.js:251:18
    at context.callback (C:\dev\projects\rascal\rascal-website\node_modules\loader-runner\lib\LoaderRunner.js:124:13)
    at Object.mdxLoader (C:\dev\projects\rascal\rascal-website\node_modules\@docusaurus\mdx-loader\lib\loader.js:153:16)

I had to add a JSON.stringify in the node_modules source of NormalModule.js to get it print something more meaningful than '[Object object]', that's why it prints {"error":1,"offset":0,"length":5}.

What does it mean, and how can I fix it? :)