From ef62bf3bf17a92d96c48962ae8f965bcf20ace0e Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Mon, 24 Oct 2022 12:32:43 -0700 Subject: [PATCH] Fix module trace error messages to not include queries (#41738) This improves errors like this: ``` One of these is marked as a client entry with "use client": app/page2/page.tsx?__edge_ssr_entry__ ``` ## 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 lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts b/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts index 0c78ff1d82f6d..7b3a271a5a093 100644 --- a/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts +++ b/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts @@ -89,7 +89,9 @@ export function getRscError( formattedError[1] + moduleTrace .map((m) => - m.resource ? ' ' + relative(compiler.context, m.resource) : '' + m.resource + ? ' ' + relative(compiler.context, m.resource).replace(/\?.+$/, '') + : '' ) .filter(Boolean) .join('\n')