NextJS static build fails
Closed this issue · 2 comments
waldenn commented
Cool idea! I got it working and wanted to build a static NextJS app (easier to deploy), but this failed with the errors below.
next.config.mjs:
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export'
};
export default nextConfig;
errors (after disabling eslint rules):
$ npm run build
> learn-thing@0.1.0 build
> next build
▲ Next.js 14.2.15
- Environments: .env.local
Creating an optimized production build ...
✓ Compiled successfully
Failed to compile.
./app/components/MindMap.tsx
166:56 Error: React Hook "useMemo" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
170:44 Error: React Hook "useNodesState" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
171:44 Error: React Hook "useEdgesState" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
173:18 Error: React Hook "useCallback" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
177:23 Error: React Hook "useCallback" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
181:21 Error: React Hook "useMemo" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
aotakeda commented
Hey, this should be fixed!
waldenn commented
The static build works now (thanks!), but the app does not yet work properly as client-side app:
127.0.0.1 - - code 501, message Unsupported method ('POST')
127.0.0.1 - - "POST /api/chat HTTP/1.1" 501 ("Not Implemented") -
I am trying to use your app in a client-only fashion, where the user can provide their OpenAI key.