From e0b946a4bbb10b2ebb58bd34489147c6e9a33b7e Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Wed, 9 Nov 2022 17:26:55 -0800 Subject: [PATCH] Fix replaceAll usage in post-process (#42714) Similar to https://github.com/vercel/next.js/pull/42550 Fixes: https://dev.azure.com/nextjs/next.js/_build/results?buildId=43629&view=logs&jobId=14d0eb3f-bc66-5450-3353-28256327ad6c x-ref: https://github.com/vercel/next.js/pull/42495 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) --- packages/next/server/post-process.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/server/post-process.ts b/packages/next/server/post-process.ts index c64d406a08c07c5..ca1ec000fa2dad2 100644 --- a/packages/next/server/post-process.ts +++ b/packages/next/server/post-process.ts @@ -231,7 +231,7 @@ async function postProcessHTML( : null, inAmpMode || hybridAmp ? (html: string) => { - return html.replaceAll('&amp=1', '&=1') + return html.replace(/&amp=1/g, '&=1') } : null, ].filter(nonNullable)