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

Static Build generateStaticParams Error #785

Closed
1 task done
tonynacumoto opened this issue Mar 23, 2024 · 3 comments
Closed
1 task done

Static Build generateStaticParams Error #785

tonynacumoto opened this issue Mar 23, 2024 · 3 comments
Labels
waiting Can't start working on the issue (it has dependencies)

Comments

@tonynacumoto
Copy link

Is there an existing issue for this?

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 :)

@technophile-04
Copy link
Collaborator

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 :

Screenshot 2024-03-24 at 10 37 32 PM

(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 :(

@technophile-04 technophile-04 added the waiting Can't start working on the issue (it has dependencies) label Mar 24, 2024
@tonynacumoto
Copy link
Author

worked - thnxs

@technophile-04
Copy link
Collaborator

Completed at #825

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Can't start working on the issue (it has dependencies)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants