My webpage is located within the directory src/app/c/patient/[id]/page.tsx
. Everything is functioning correctly when deployed, but I'm trying to export it to a js bundle for use with the Capacitor Android/iOS app. However, I encountered the following error:
Error: Page "/c/patient/[id]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.
To address this, I added the following code:
export async function generateStaticParams(): Promise<any> {
return new Promise(resolve => {
resolve([]);
});
}
Despite this addition, the error persisted. Here is the full file for reference:
// ----------------------------------------------------------------------
export const metadata = {
title: 'Patient',
};
type Props = {
params: {
id: string;
};
};
export async function generateStaticParams(): Promise<any> {
return new Promise(resolve => {
resolve([]);
});
}
export default function PatientPage({ params }: Props) {
const { id } = params;
return <PatientProfileView patientUserId={id as string}/>;
}
I'm puzzled as to why the error persists even though the required function is in place. Additionally, I'm uncertain if the dynamic routes will still function as intended once the static export is successful (specifically, will const { id } = params
extract the /[id] portion of the URL in a static export?