Skip to content

Commit fb8e33e

Browse files
authored
Tighten up includes/excludes (#15813)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR Slight reconfiguration to the allowlist and blocklist of files that are or are not needed by the vercel serverless functions. This is tightening up changes made in #15452 and some subsequent updates to these lists. ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
1 parent 78a6609 commit fb8e33e

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

next.config.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import {redirects} from './redirects.js';
99
// needed during the build process to compile MDX and optimize assets. The compiled
1010
// output is used at runtime, so bundling these ~150-200MB of dependencies would bloat
1111
// functions unnecessarily and cause deployment failures.
12+
//
13+
// Note: mdx-bundler/client (getMDXComponent) is a tiny runtime module needed by
14+
// app/[[...path]]/page.tsx, so we exclude only the build parts (dist/!(client)*).
1215
const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
1316
? {
1417
'/**/*': [
@@ -27,8 +30,9 @@ const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
2730
'node_modules/@prettier/**/*',
2831
'node_modules/sharp/**/*',
2932
'node_modules/mermaid/**/*',
30-
// Exclude MDX processing dependencies
31-
'node_modules/mdx-bundler/**/*',
33+
// Exclude MDX processing dependencies (but keep mdx-bundler/client for runtime)
34+
'node_modules/mdx-bundler/dist/!(client*)',
35+
'node_modules/mdx-bundler/node_modules/**/*',
3236
'node_modules/rehype-preset-minify/**/*',
3337
'node_modules/rehype-prism-plus/**/*',
3438
'node_modules/rehype-prism-diff/**/*',
@@ -55,8 +59,9 @@ const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
5559
'node_modules/@prettier/**/*',
5660
'node_modules/sharp/**/*',
5761
'node_modules/mermaid/**/*',
58-
// Exclude MDX processing dependencies
59-
'node_modules/mdx-bundler/**/*',
62+
// Exclude MDX processing dependencies (but keep mdx-bundler/client for runtime)
63+
'node_modules/mdx-bundler/dist/!(client*)',
64+
'node_modules/mdx-bundler/node_modules/**/*',
6065
'node_modules/rehype-preset-minify/**/*',
6166
'node_modules/rehype-prism-plus/**/*',
6267
'node_modules/rehype-prism-diff/**/*',
@@ -72,6 +77,8 @@ const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
7277
'**/*.pdf',
7378
],
7479
'\\[\\[\\.\\.\\.path\\]\\]': [
80+
// Exclude docs to save ~156MB, but allow specific files via outputFileTracingIncludes
81+
// for pages that may be accessed at runtime (error pages, cold starts, etc.)
7582
'docs/**/*',
7683
'node_modules/prettier/plugins',
7784
'node_modules/rollup/dist',
@@ -90,17 +97,24 @@ const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
9097
// Both platform-redirect and [[...path]] need the doctree at runtime:
9198
// - platform-redirect: dynamic route with searchParams
9299
// - [[...path]]: calls getDocsRootNode() during prerendering (even though force-static)
93-
// Additionally, [[...path]] needs source files for pages using ISR (Incremental Static Regeneration):
94-
// - changelog.mdx: uses ISR with 1-hour revalidation to fetch fresh content (user docs only)
95-
// Other routes read frontmatter from source files instead of using doctree (sitemap, api/source-map)
100+
//
101+
// Additionally, include specific doc files that may be accessed at runtime due to:
102+
// - Error page rendering (when a static page fails to load)
103+
// - Cold start edge cases during deployment
104+
// - On-demand revalidation requests
105+
// These are whitelisted individually to avoid including the entire docs/ directory.
96106
const outputFileTracingIncludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS
97107
? {
98108
'/platform-redirect': ['public/doctree-dev.json'],
99109
'\\[\\[\\.\\.\\.path\\]\\]': ['public/doctree-dev.json'],
100110
}
101111
: {
102112
'/platform-redirect': ['public/doctree.json'],
103-
'\\[\\[\\.\\.\\.path\\]\\]': ['public/doctree.json', 'docs/changelog.mdx'],
113+
'\\[\\[\\.\\.\\.path\\]\\]': [
114+
'public/doctree.json',
115+
'docs/changelog.mdx',
116+
'docs/platforms/index.mdx',
117+
],
104118
};
105119

106120
if (process.env.NODE_ENV !== 'development' && !process.env.NEXT_PUBLIC_SENTRY_DSN) {

0 commit comments

Comments
 (0)