Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/cloudflare/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ declare global {
OPEN_NEXT_ORIGIN: string;
}
}

interface Window {
[key: string]: string | Fetcher;
}
}

export {};
2 changes: 1 addition & 1 deletion packages/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"vitest": "catalog:"
},
"dependencies": {
"@opennextjs/aws": "https://pkg.pr.new/@opennextjs/aws@2202f36",
"@opennextjs/aws": "https://pkg.pr.new/@opennextjs/aws@d2ead58",
"ts-morph": "catalog:"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cloudflare/src/cli/build/bundle-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export async function bundleServer(config: Config, openNextOptions: BuildOptions
// __dirname is used by unbundled js files (which don't inherit the __dirname present in the define field)
// so we also need to set it on the global scope
// Note: this was hit in the next/dist/compiled/@opentelemetry/api module

globalThis.__dirname ??= "";

// Do not crash on cache not supported
Expand Down Expand Up @@ -168,6 +167,7 @@ async function updateWorkerBundledCode(

patchedCode = patchedCode
// workers do not support dynamic require nor require.resolve
// TODO: implement for cf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a note that this can be done in @opennextjs/aws, not necessarily here

.replace("patchAsyncStorage();", "//patchAsyncStorage();")
.replace('require.resolve("./cache.cjs")', '"unused"');

Expand Down
4 changes: 4 additions & 0 deletions packages/cloudflare/src/cli/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export async function build(projectOpts: ProjectOptions): Promise<void> {
const options = buildHelper.normalizeOptions(config, openNextDistDir, buildDir);
logger.setLevel(options.debug ? "debug" : "info");

// Do not minify the code so that we can apply string replacement patch.
// Note that wrangler will still minify the bundle.
options.minify = false;

// Pre-build validation
buildHelper.checkRunningInsideNextjsApp(options);
logger.info(`App directory: ${options.appPath}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async function generateBundle(
const isBundled = fnOptions.experimentalBundledNextServer ?? false;
if (isBundled) {
await bundleNextServer(path.join(outputPath, packagePath), appPath, {
debug: options.debug,
minify: options.minify,
});
}

Expand Down
46 changes: 23 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ catalog:
"tsx": ^4.19.2
"typescript-eslint": ^8.7.0
"vitest": ^2.1.1
"wrangler": ^3.87.0
"wrangler": ^3.91.0