Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions packages/cloudflare/src/cli/build/bundle-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ export async function bundleServer(buildOpts: BuildOptions): Promise<void> {
],
external: ["./middleware/handler.mjs"],
alias: {
// Note: it looks like node-fetch is actually not necessary for us, so we could replace it with an empty shim
// but just to be safe we replace it with a module that re-exports the native fetch
// we do this to both save on bundle size (there isn't really any benefit in us shipping the node-fetch code)
// and also get rid of a warning in the terminal caused by the package (because it performs an === comparison with -0)
"next/dist/compiled/node-fetch": path.join(buildOpts.outputDir, "cloudflare-templates/shims/fetch.js"),
// Note: we apply an empty shim to next/dist/compiled/ws because it generates two `eval`s:
// eval("require")("bufferutil");
// eval("require")("utf-8-validate");
Expand Down
1 change: 1 addition & 0 deletions packages/cloudflare/src/cli/templates/shims/fetch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default fetch;