Skip to content

Commit c135bf0

Browse files
rjgtavRicardo Tavares
andauthored
fix(templates): ignore wrangler when bundling to fix template styles (#14067)
### What? Adds the missing `/* webpackIgnore: true */` annotation when importing wrangler, as in the original OpenNext patch. ### Why? It looks like Webpack messes up the template styles when bundling the Cloudflare template, which causes some issues such as black text on black background or larger than usual font size. ### How? By telling Webpack to ignore wrangler when bundling. This solution was found by @nwong212 in the original issue, I'm just submitting the fix after checking my self that it indeed fixes the bundling. Fixes #13989 Co-authored-by: Ricardo Tavares <rtavares@cloudflare.com>
1 parent c59df45 commit c135bf0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

templates/with-cloudflare-d1/src/payload.config.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ export default buildConfig({
4646

4747
// Adapted from https://github.com/opennextjs/opennextjs-cloudflare/blob/d00b3a13e42e65aad76fba41774815726422cc39/packages/cloudflare/src/api/cloudflare-context.ts#L328C36-L328C46
4848
function getCloudflareContextFromWrangler(): Promise<CloudflareContext> {
49-
return import(`${'__wrangler'.replaceAll('_', '')}`).then(({ getPlatformProxy }) =>
50-
getPlatformProxy({
51-
environment: process.env.CLOUDFLARE_ENV,
52-
experimental: { remoteBindings: cloudflareRemoteBindings },
53-
} satisfies GetPlatformProxyOptions),
49+
return import(/* webpackIgnore: true */ `${'__wrangler'.replaceAll('_', '')}`).then(
50+
({ getPlatformProxy }) =>
51+
getPlatformProxy({
52+
environment: process.env.CLOUDFLARE_ENV,
53+
experimental: { remoteBindings: cloudflareRemoteBindings },
54+
} satisfies GetPlatformProxyOptions),
5455
)
5556
}

0 commit comments

Comments
 (0)