Static Build generateStaticParams Error
tonynacumoto opened this issue · 3 comments
Is there an existing issue for this?
- I have looked through the existing issues
Which method was used to setup Scaffold-ETH 2 ?
git clone
Current Behavior
I'm attempting to build a static site from the nextjs app. When I add output: 'export',
to my next.config.js file I get the error Error: Page "/blockexplorer/transaction/[txHash]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.
I've looked around, and apparently this is an issue with combining dynamic routes with "use state".
Expected Behavior
I would hope that out of the box I could export the nextjs app without having to re-write any files. Would be great to host on IPFS or other static site hosting platforms, which there probably is a way other than how I'm trying to do it -- will look deeper into the documentation.
Steps To Reproduce
clone, add output: 'export',
to next.config.js file, move into the packages/nextjs
repo then yarn install && yarn build
Anything else?
Nope, awesome repo guys :)
Hey thanks for raising it 🙌, I think for now the only solution is to mark blockexplorer/address
and blockexplorer/transaction
as private by appending _
before their name, example :
(Instead of marking both files as private we could mark whole blockexplorer dir as private before deploying, but due to import alias the build fails, something which can fixed on SE-2 side)
But any which ways I people need to manually mark the dir's as private before deploying.
Ideally this should have been solved if we have used useParams
in blockexplorer/address/[address]/page.ts
and same for [txHash]/page.ts
instead of relying on Next Page props
But NextJs has the issue with output: 'export',
checkout : vercel/next.js#54393, they said it will solved soon but they haven't yet :(
An hacky solution which people are suggesting is to use useSearchParams
but it seems too hacky and not sure how well it will play :(
worked - thnxs
Completed at #825