Skip to content

Commit 579cee0

Browse files
committed
fix
1 parent a8992e4 commit 579cee0

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

packages/adapter-cloudflare/index.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,24 @@ function get_routes_json(builder, assets) {
7171
* The list of routes that will _not_ invoke functions (which cost money).
7272
* This is done on a best-effort basis, as there is a limit of 100 rules
7373
*/
74-
const exclude = [`/${builder.config.kit.appDir}/*`];
74+
const exclude = [
75+
`/${builder.config.kit.appDir}/*`,
76+
...assets.filter((file) => !file.startsWith(`${builder.config.kit.appDir}/`))
77+
];
7578

76-
const MAX_EXCLUSIONS = 98; // 100 minus existing include/exclude rules
79+
const MAX_EXCLUSIONS = 99; // 100 minus existing `include` rules
7780
let excess;
7881

79-
if (assets.length > MAX_EXCLUSIONS) {
82+
if (exclude.length > MAX_EXCLUSIONS) {
8083
excess = 'static assets';
8184

8285
if (builder.prerendered.paths.length > 0) {
8386
excess += ' or prerendered routes';
8487
}
85-
} else if (assets.length + builder.prerendered.paths.length > MAX_EXCLUSIONS) {
88+
} else if (exclude.length + builder.prerendered.paths.length > MAX_EXCLUSIONS) {
8689
excess = 'prerendered routes';
8790
}
8891

89-
for (const file of assets) {
90-
if (!file.startsWith(`${builder.config.kit.appDir}/`)) {
91-
exclude.push(`/${file}`);
92-
}
93-
}
94-
9592
for (const path of builder.prerendered.paths) {
9693
if (!builder.prerendered.redirects.has(path)) {
9794
exclude.push(path);

0 commit comments

Comments
 (0)