Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: with Next.js app #461

Closed
maccman opened this issue Apr 19, 2023 · 6 comments
Closed

Error: with Next.js app #461

maccman opened this issue Apr 19, 2023 · 6 comments

Comments

@maccman
Copy link

maccman commented Apr 19, 2023

I'm trying to use shiki with Next.js's app setup.

Sporadically I'm getting this error. It seems non-deterministic.



at /vercel/path0/node_modules/vscode-oniguruma/release/main.js:1:3101
--
22:34:01.941 | at new u (/vercel/path0/node_modules/vscode-oniguruma/release/main.js:1:3150)
22:34:01.941 | at n.createOnigScanner (/vercel/path0/node_modules/vscode-oniguruma/release/main.js:1:4984)
22:34:01.941 | at Object.createOnigScanner (/vercel/path0/node_modules/@maccman/shiki/dist/index.js:1926:34)
22:34:01.941 | at g.createOnigScanner (/vercel/path0/node_modules/vscode-textmate/release/main.js:1:4532)
22:34:01.941 | at new m (/vercel/path0/node_modules/vscode-textmate/release/main.js:1:47463)
22:34:01.941 | at g.compile (/vercel/path0/node_modules/vscode-textmate/release/main.js:1:46704)
22:34:01.941 | at g.compileAG (/vercel/path0/node_modules/vscode-textmate/release/main.js:1:47238)
22:34:01.941 | at u.compileAG (/vercel/path0/node_modules/vscode-textmate/release/main.js:1:38683)
22:34:01.941 | at l (/vercel/path0/node_modules/vscode-textmate/release/main.js:1:22586)


Error: \(([^\(\)]\|(\(([^\(\)]\|\([^\(\)]*\))*\)))*\))\|(\[([^\[\]]\|(\[([^\[\]]\|\[[^\[\]]*\])*\]))*\]))([^=<>]\|=[^<]\|\<\s*(((const\s+)?[_$[:alpha:]])\|(\{([^\{\}]\|(\{([^\{\}]\|\{[^\{\}]*\})*\}))*\})\|(\(([^\(\)]\|(\(([^\(\)]\|\([^\(\)]*\))*\)))*\))\|(\[([^\[\]]\|(\[([^\[\]]\|\[[^\[\]]*\])*\]))*\]))([^=<>]\|=[^<]\|\<\s*(((const\s+)?[_$[:alpha:]])\|(\{([^\{\}]\|(\{([^\{\}]\|\{[^\{\}]*\})*\}))*\})\|(\(([^\(\)]\|(\(([^\(\)]\|\([^\(\)]*\))*\)))*\))\|(\[([^\[\]]\|(\[([^\[\]]\|\[[^\[\]]*\])*\]))*\]))([^=<>]\|=[^<])*\>)*\>)*>\s*)?                                                                                 # typeparameters
--
22:29:48.533 | \(\s*(\/\*([^\*]\|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]\|(\{([^\{\}]\|(\{([^\{\}]\|\{[^\{\}]*\})*\}))*\})\|(\[([^\[\]]\|(\[([^\[\]]\|\[[^\[\]]*\])*\]))*\])\|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]\|(\(([^\(\)]\|(\(([^\(\)]\|\([^\(\)]*\))*\)))*\))\|(\'([^\'\\]\|\\.)*\')\|(\"([^\"\\]\|\\.)*\")\|(\`([^\`\\]\|\\.)*\`))*)?\)   # parameters
22:29:48.533 | (\s*:\s*([^<>\(\)\{\}]\|\<([^<>]\|\<([^<>]\|\<[^<>]+\>)+\>)+\>\|\([^\(\)]+\)\|\{[^\{\}]+\})+)?                                                                        # return type
22:29:48.533 | \s*=>
@octref
Copy link
Collaborator

octref commented Apr 29, 2023

Why is it non-deterministic? Does it happen randomly for the same code highlighted? Can you get a minimal repro?

@diegohaz
Copy link

diegohaz commented May 6, 2023

I get a similar error during next dev. As @maccman mentioned, it happens sporadically. I've never been able to reproduce it consistently. That's why I didn't open an issue.

I can only get rid of the error by restarting the dev server until it happens again after minutes or hours.

screenshot of the error described above

Here's the code. I'm sorry it's not a minimal repro. Just putting here in case it's helpful: https://github.com/ariakit/ariakit/blob/d257a3edb431ac1f36cda9ca76c1ea160ff4481d/website/components/code-block.tsx#L56-L58

@tannerabread
Copy link

tannerabread commented May 11, 2023

Getting the same error in my Next.js app using the new app router functionality. Using [email protected]

Looks the same as #417 and #433

Following this comment from @orta didn't help, tried old versions and different themes (nord, dracula, dracula-soft).

I can only get rid of the error by restarting the dev server until it happens again after minutes or hours.

To get rid of my build error I had to delete one of my blog post so it wouldn't be included. But for local I do the same thing with the dev server

@octref
Copy link
Collaborator

octref commented May 27, 2023

Hey @tannerabread, does it happen with consistently with that blog post? Can you post a minimal repro?

@tannerabread
Copy link

@octref it was consistent enough that I couldn't build my app, locally or on Vercel

It was inconsistent with most posts I was adding to my project but seemed really consistent with this markdown file. Sometimes the project would build if I removed that file and sometimes not

I was finally able to get around it by switching to MDX vs .md files and using shiki in conjunction with rehype-pretty-code and a completely different architecture as outlined here

A big key in the solution seemed to be including the plugins with .next.config.mjs as shown in the new docs for Next.js app router

@antfu
Copy link
Member

antfu commented Jan 26, 2024

We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info.
Please provide a minimal reproduction to reopen the issue.
Thanks.

Why reproduction is required

@antfu antfu closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants