Skip to content

Commit 67a1c25

Browse files
committed
option to generate sourcemap for handler.mjs
1 parent c46eeee commit 67a1c25

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/cloudflare/src/api/config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export function defineCloudflareConfig(config: CloudflareOverrides = {}): OpenNe
9090
edgeExternals: ["node:crypto"],
9191
cloudflare: {
9292
useWorkerdCondition: true,
93+
sourcemap: false,
9394
},
9495
dangerous: {
9596
enableCacheInterception,
@@ -154,6 +155,14 @@ interface OpenNextConfig extends AwsOpenNextConfig {
154155
*/
155156
useWorkerdCondition?: boolean;
156157

158+
/**
159+
* Whether to genereate a sourcemap for the bundled server.
160+
*
161+
*
162+
* @default false
163+
*/
164+
sourcemap?: boolean;
165+
157166
/**
158167
* Disable throwing an error when the config validation fails.
159168
* This is useful for overriding some of the default provided by cloudflare.

packages/cloudflare/src/cli/build/bundle-server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
8181
minifySyntax: !debug,
8282
legalComments: "none",
8383
metafile: true,
84+
sourcemap: getOpenNextConfig(buildOpts).cloudflare?.sourcemap,
8485
// Next traces files using the default conditions from `nft` (`node`, `require`, `import` and `default`)
8586
//
8687
// Because we use the `node` platform for this build, the "module" condition is used when no conditions are defined.

0 commit comments

Comments
 (0)