Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 14, 2025

Fixes the missing Next.js export names reported in the issue by adding support for three additional Next.js App Router API functions to the allowExportNames configuration in the Next.js config preset.

Changes

Added the following export names to the Next.js config's allowExportNames array:

These functions are part of Next.js's App Router API and can be exported alongside React components in page/layout files without triggering fast refresh issues.

Example Usage

With this change, the following code will no longer trigger an ESLint warning when using the Next.js config:

// app/blog/[slug]/page.tsx
export async function generateStaticParams() {
  const posts = await fetch('https://...').then(res => res.json())
  return posts.map((post) => ({ slug: post.slug }))
}

export default function Page({ params }: { params: { slug: string } }) {
  return <div>Blog post: {params.slug}</div>
}

Testing

  • All existing tests pass (69 tests)
  • Linting and build complete successfully

Fixes #91

Original prompt

This section details on the original issue you should resolve

<issue_title>Next.js missing only-export-components and allowExportNames</issue_title>
<issue_description>I found a few new ones for Next.js:

Comments on the Issue (you are @copilot in this section)

Fixes #91


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…maps, generateStaticParams

Co-authored-by: ArnaudBarre <[email protected]>
@Copilot Copilot AI changed the title [WIP] Add missing only-export-components and allowExportNames Add missing Next.js export names: generateImageMetadata, generateSitemaps, generateStaticParams Oct 14, 2025
@Copilot Copilot AI requested a review from ArnaudBarre October 14, 2025 19:25
Copilot finished work on behalf of ArnaudBarre October 14, 2025 19:25
@ArnaudBarre
Copy link
Owner

@copilot Please don't add new tests, they are not useful

Copy link
Contributor Author

Copilot AI commented Oct 15, 2025

@copilot Please don't add new tests, they are not useful

Removed the test cases in commit {{commit_hash}}.

Copilot finished work on behalf of ArnaudBarre October 15, 2025 07:22
@ArnaudBarre ArnaudBarre changed the title Add missing Next.js export names: generateImageMetadata, generateSitemaps, generateStaticParams Add generate{ImageMetadata,Sitemaps,StaticParams} to Next config [publish] Oct 15, 2025
@ArnaudBarre ArnaudBarre marked this pull request as ready for review October 15, 2025 08:58
@ArnaudBarre ArnaudBarre merged commit 2bb4fab into main Oct 15, 2025
2 checks passed
@ArnaudBarre ArnaudBarre deleted the copilot/add-nextjs-export-functions branch October 15, 2025 08:58

## 0.4.24

- Add `"generateImageMetadata"`, `"generateSitemaps"` & `"generateStaticParams"` to `allowExportNames` in Next config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot made a mistake adding allowExportNames, but not a big deal.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the issue, is there a typo I don't see?

Copy link
Contributor

@thernstig thernstig Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you are right. I read it wrong. Nothing to see 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Next.js missing only-export-components and allowExportNames

3 participants