#Next.JS Exclude Export Path
1 messages · Page 1 of 1 (latest)
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:
-
Next.js provides a configuration option called
pageExtensionsthat 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. -
For the Pages Router, there was a way to disable file-system routing using the
useFileSystemPublicRoutesconfiguration 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. -
Next.js 15 introduced the
bundlePagesRouterDependenciesoption, 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.