I met an error on building using output: “export” to generate en static site.
I’m using next 14.0.3
The only possible solution I found here is to downgrade to v13, but is there a better solution now?
The error :
Error: Page “/leslessives/[id]” is missing “generateStaticParams()” so it cannot be used with “output: export” config.
Here is my file app/leslesssives/[id]/page.tsx :
// Return a list of `params` to populate the [id] dynamic segment
export async function generateStaticParams() {
try {
// Fetch product data from the API
const { data: products } = await getStrapiData("/api/products")
console.log(products)
// Map product IDs to static paths
return products.map((product) => ({
id: product.id.toString(),
}))
} catch (error) {
console.error("Error fetching product IDs:", error)
return [] // Return an empty array in case of an error
}
}
// Multiple versions of this page will be statically generated
// using the `params` returned by `generateStaticParams`
export default async function Web({ params }: { params: { id: string } }) {
const { id } = params
const product = await getProductById(`/api/products/${id}`)
return (