Skip to content

Commit 903ad45

Browse files
authored
perf: drop babel to reduce the server bundle size (#710)
1 parent 56e9366 commit 903ad45

File tree

6 files changed

+160
-416
lines changed

6 files changed

+160
-416
lines changed

.changeset/loud-seas-rhyme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
perf: drop babel to reduce the server bundle size

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@changesets/changelog-github": "^0.5.1",
77
"@changesets/cli": "^2.29.2",
88
"@playwright/test": "catalog:",
9-
"pkg-pr-new": "^0.0.29",
9+
"pkg-pr-new": "^0.0.51",
1010
"prettier": "3.3.3"
1111
},
1212
"scripts": {

packages/cloudflare/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"homepage": "https://github.com/opennextjs/opennextjs-cloudflare",
5454
"dependencies": {
5555
"@dotenvx/dotenvx": "catalog:",
56-
"@opennextjs/aws": "3.6.4",
56+
"@opennextjs/aws": "3.6.5",
5757
"enquirer": "^2.4.1",
5858
"glob": "catalog:",
5959
"ts-tqdm": "^0.8.6"

packages/cloudflare/src/cli/build/open-next/createServerBundle.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,7 @@ import * as buildHelper from "@opennextjs/aws/build/helper.js";
1313
import { installDependencies } from "@opennextjs/aws/build/installDeps.js";
1414
import type { CodePatcher } from "@opennextjs/aws/build/patch/codePatcher.js";
1515
import { applyCodePatches } from "@opennextjs/aws/build/patch/codePatcher.js";
16-
import {
17-
patchEnvVars,
18-
patchFetchCacheForISR,
19-
patchFetchCacheSetMissingWaitUntil,
20-
patchNextServer,
21-
patchUnstableCacheForISR,
22-
patchUseCacheForISR,
23-
} from "@opennextjs/aws/build/patch/patches/index.js";
24-
// TODO: import from patches/index.js when https://github.com/opennextjs/opennextjs-aws/pull/827 is released
25-
import { patchBackgroundRevalidation } from "@opennextjs/aws/build/patch/patches/patchBackgroundRevalidation.js";
16+
import * as awsPatches from "@opennextjs/aws/build/patch/patches/index.js";
2617
import logger from "@opennextjs/aws/logger.js";
2718
import { minifyAll } from "@opennextjs/aws/minimize-js.js";
2819
import type { ContentUpdater } from "@opennextjs/aws/plugins/content-updater.js";
@@ -208,13 +199,14 @@ async function generateBundle(
208199
const additionalCodePatches = codeCustomization?.additionalCodePatches ?? [];
209200

210201
await applyCodePatches(options, tracedFiles, manifests, [
211-
patchFetchCacheSetMissingWaitUntil,
212-
patchFetchCacheForISR,
213-
patchUnstableCacheForISR,
214-
patchUseCacheForISR,
215-
patchNextServer,
216-
patchEnvVars,
217-
patchBackgroundRevalidation,
202+
awsPatches.patchFetchCacheSetMissingWaitUntil,
203+
awsPatches.patchFetchCacheForISR,
204+
awsPatches.patchUnstableCacheForISR,
205+
awsPatches.patchUseCacheForISR,
206+
awsPatches.patchNextServer,
207+
awsPatches.patchEnvVars,
208+
awsPatches.patchBackgroundRevalidation,
209+
awsPatches.patchDropBabel,
218210
// Cloudflare specific patches
219211
patchResRevalidate,
220212
patchUseCacheIO,

0 commit comments

Comments
 (0)