fuma-nama / fumadocs

The beautiful docs framework with Next.js. Alternative to Nextra
https://fumadocs.vercel.app
MIT License
1.89k stars 115 forks source link

Build error #791

Closed RUNFUNRUN closed 2 months ago

RUNFUNRUN commented 2 months ago

To Reproduce

  1. create fumadocs app
    bun create fumadocs-app

2.build

bun run build

It is also reproducible in my project. https://github.com/RUNFUNRUN/blog

Current vs. Expected behavior

Build successful

bun run build
$ next build
  ▲ Next.js 14.2.7
  - Experiments (use with caution):
    · turbo

   Creating an optimized production build ...
[MDX] initialized map file
<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/modules|javascript/auto|/home/runfunrun/Documents/test/my-app/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js!/home/runfunrun/Documents/test/my-app/node_modules/next/dist/build/webpack/loaders/next-swc-loader.js??ruleSet[1].rules[20].use[0]!/home/runfunrun/Documents/test/my-app/node_modules/fumadocs-mdx/loader-mdx.js??ruleSet[1].rules[20].use[1]!/home/runfunrun/Documents/test/my-app/content/docs/test.mdx?collection=docs&hash=1f6bdb4ca1902e1116f178436a2432db3c32e973f175a17c551eba27edcb8dac|rsc': No serializer registered for ShikiError
<w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> webpack/lib/NormalModule -> webpack/lib/ModuleBuildError -> ShikiError
Failed to compile.

./content/docs/test.mdx?collection=docs&hash=1f6bdb4ca1902e1116f178436a2432db3c32e973f175a17c551eba27edcb8dac
ShikiError: test.mdx:ShikiError: Must invoke loadWasm first.
    at new OnigString (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/core/dist/index.mjs:4954:19)
    at Object.createString (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/core/dist/index.mjs:5175:20)
    at Object.createOnigString (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/core/dist/index.mjs:5470:43)
    at Grammar.createOnigString (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/vscode-textmate/dist/main.mjs:2263:26)
    at Grammar._tokenize (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/vscode-textmate/dist/main.mjs:2419:31)
    at Grammar.tokenizeLine2 (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/vscode-textmate/dist/main.mjs:2357:20)
    at _tokenizeWithTheme (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/core/dist/index.mjs:855:32)
    at tokenizeWithTheme (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/core/dist/index.mjs:812:12)
    at codeToTokensBase (file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/core/dist/index.mjs:799:12)
    at file:///home/runfunrun/Documents/test/my-app/node_modules/@shikijs/core/dist/index.mjs:970:62

Import trace for requested module:
./content/docs/test.mdx?collection=docs&hash=1f6bdb4ca1902e1116f178436a2432db3c32e973f175a17c551eba27edcb8dac
./.source/index.js
./app/source.ts
./app/api/search/route.ts

> Build failed because of webpack errors
error: script "build" exited with code 1

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Fri Mar 29 23:14:13 UTC 2024
  Available memory (MB): 32005
  Available CPU cores: 20
Binaries:
  Node: 22.7.0
  npm: 10.8.2
  Yarn: N/A
  pnpm: 8.15.4
Relevant Packages:
  next: 14.2.7 // Latest available version is detected (14.2.7).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

CLI (create-fumadocs-app), Examples

Additional context

This occurred when updating to Fumadocs MDX v10.

It works fine in the development environment.

fuma-nama commented 2 months ago

I found the problem after some debugging Shirk v1.16 changed some APIs which breaks the usage of their rehype plugin, downgrading to 1.15 helps, or you can enable experimental JS engine which still works fine

RUNFUNRUN commented 2 months ago

I updated fumadocs-core and fumacocs-ui and it builds fine! Thanks for fixing it.