[WIP] Fix module not found error for fumadocs-ui card component#327
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 23:07:49.096
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
7a5ffc2
into
copilot/improve-zod-protocol-display
There was a problem hiding this comment.
Pull request overview
This PR addresses module resolution errors in the Next.js documentation site by removing unnecessary fumadocs-ui component imports from MDX files and centralizing component registration in the page rendering configuration.
Changes:
- Removed redundant fumadocs-ui component imports from 449 MDX files
- Added Tab and Tabs components to the centralized MDX components object
- Updated webpack configuration to resolve fumadocs-ui component paths
- Removed experimental Turbopack configuration
- Simplified build script by removing NEXT_PRIVATE_BUILD_WORKER flag
Reviewed changes
Copilot reviewed 300 out of 452 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| content/docs/references/**/*.mdx (449 files) | Removed redundant fumadocs-ui component imports that were causing module resolution errors |
| apps/docs/app/[lang]/docs/[[...slug]]/page.tsx | Added Tab and Tabs to centralized components object for MDX rendering |
| apps/docs/next.config.mjs | Updated webpack aliases to resolve fumadocs-ui components and lucide-react, removed experimental turbo configuration |
| apps/docs/package.json | Removed NEXT_PRIVATE_BUILD_WORKER environment variable from build script |
| 'fumadocs-ui/components/callout$': path.resolve(__dirname, './node_modules/fumadocs-ui/dist/components/callout.js'), | ||
| 'fumadocs-ui/components/card$': path.resolve(__dirname, './node_modules/fumadocs-ui/dist/components/card.js'), | ||
| 'fumadocs-ui/components/tabs$': path.resolve(__dirname, './node_modules/fumadocs-ui/dist/components/tabs.js'), | ||
| 'lucide-react$': path.resolve(__dirname, './node_modules/lucide-react/dist/cjs/lucide-react.js'), |
There was a problem hiding this comment.
The webpack aliases use relative paths starting with ./node_modules/ which assumes a specific directory structure. This could break if the project uses workspaces or pnpm where node_modules might be hoisted. Consider using require.resolve() for more reliable module resolution across different package manager configurations.
| 'fumadocs-ui/components/callout$': path.resolve(__dirname, './node_modules/fumadocs-ui/dist/components/callout.js'), | ||
| 'fumadocs-ui/components/card$': path.resolve(__dirname, './node_modules/fumadocs-ui/dist/components/card.js'), | ||
| 'fumadocs-ui/components/tabs$': path.resolve(__dirname, './node_modules/fumadocs-ui/dist/components/tabs.js'), | ||
| 'lucide-react$': path.resolve(__dirname, './node_modules/lucide-react/dist/cjs/lucide-react.js'), |
There was a problem hiding this comment.
The lucide-react alias points to the CJS (CommonJS) build, but Next.js prefers ESM modules for better tree-shaking and performance. Consider using the ESM build path instead: lucide-react/dist/esm/lucide-react.js.
| 'lucide-react$': path.resolve(__dirname, './node_modules/lucide-react/dist/cjs/lucide-react.js'), | |
| 'lucide-react$': path.resolve(__dirname, './node_modules/lucide-react/dist/esm/lucide-react.js'), |
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.