From dc74ffe6d87274e6c8fe8257dad21c2cd5ac95a6 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Mon, 24 Apr 2023 16:17:42 +0100 Subject: [PATCH] properly align invalid functions in error message (#195) --- .changeset/clever-queens-cough.md | 5 +++++ src/buildApplication/buildApplication.ts | 28 ++++++++++++++---------- 2 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 .changeset/clever-queens-cough.md diff --git a/.changeset/clever-queens-cough.md b/.changeset/clever-queens-cough.md new file mode 100644 index 000000000..8314dc7dc --- /dev/null +++ b/.changeset/clever-queens-cough.md @@ -0,0 +1,5 @@ +--- +'@cloudflare/next-on-pages': patch +--- + +fix: properly align invalid functions in error message diff --git a/src/buildApplication/buildApplication.ts b/src/buildApplication/buildApplication.ts index ef2d75a94..ce2554078 100644 --- a/src/buildApplication/buildApplication.ts +++ b/src/buildApplication/buildApplication.ts @@ -120,24 +120,28 @@ async function prepareAndBuildWorker( } function printInvalidFunctionsErrorMessage(invalidFunctions: string[]): void { - cliError(` + cliError( + ` ERROR: Failed to produce a Cloudflare Pages build from the project. - The following functions were not configured to run with the Edge Runtime: - ${invalidFunctions.map(fn => ` - ${fn}`).join('\n')} + The following functions were not configured to run with the Edge Runtime:\n${invalidFunctions + .map(fn => ` - ${fn}`) + .join('\n')} - If this is a Next.js project: + If this is a Next.js project: - - you can read more about configuring Edge API Routes here: https://nextjs.org/docs/api-routes/edge-api-route - - - you can try enabling the Edge Runtime for a specific page by exporting the following from your page: + - you can read more about configuring Edge API Routes here: https://nextjs.org/docs/api-routes/edge-api-route + + - you can try enabling the Edge Runtime for a specific page by exporting the following from your page: - export const config = { runtime: 'edge' }; + export const config = { runtime: 'edge' }; - - or you can try enabling the Edge Runtime for all pages in your project by adding the following to your 'next.config.js' file: + - or you can try enabling the Edge Runtime for all pages in your project by adding the following to your 'next.config.js' file: - const nextConfig = { experimental: { runtime: 'edge'} }; + const nextConfig = { experimental: { runtime: 'edge'} }; - You can read more about the Edge Runtime here: https://nextjs.org/docs/advanced-features/react-18/switchable-runtime - `); + You can read more about the Edge Runtime here: https://nextjs.org/docs/advanced-features/react-18/switchable-runtime + `, + { spaced: true } + ); }