#Next.JS Exclude Export Path

1 messages · Page 1 of 1 (latest)

gloomy crest
#

I am using Next.JS v15.1.5 with app/ router. How can I exclude all /app/api/ files from being built during npm run build?

torpid jungleBOT
#

Hi @gloomy crest. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I apologize, but I couldn't find specific information in the provided knowledge sources about excluding /app/api/ files from being built during npm run build for Next.js version 15.1.5 with the app/ router.

However, I can provide some related information that might be helpful:

  1. Next.js provides a configuration option called pageExtensions that allows you to specify which file extensions should be treated as pages. While this doesn't directly exclude paths, it could potentially be used to control which files are included in the build. You can find more information about this in the pageExtensions documentation.

  2. For the Pages Router, there was a way to disable file-system routing using the useFileSystemPublicRoutes configuration option. However, this is specifically mentioned for custom servers and the Pages Router, not the App Router. You can read more about this in the Disabling file-system routing documentation.

  3. Next.js 15 introduced the bundlePagesRouterDependencies option, which is related to bundling dependencies for the Pages Router. While this doesn't directly address your question about excluding /app/api/ files, it shows that there are configuration options for controlling aspects of the build process. You can find more information in the Version 15 upgrade documentation.

#

Given that your question is specifically about Next.js 15.1.5 and the App Router, and the knowledge sources don't provide a direct answer, I recommend checking the official Next.js documentation or reaching out to the Next.js community forums for more specific guidance on excluding /app/api/ files from the build process.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: