rsnext/test/e2e/edge-render-getserversideprops
Ngô Đức Anh f4610c31b0
Fix outputting un-necessary trace files for edge functions (#43304)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/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`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
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`](https://github.com/vercel/next.js/blob/canary/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)

fixes #39275 and related issues like #39858 and hopefully #41395 (can't
test because `pnpm next-with-deps build ./dev-app` keeps crashing on
`Collecting page data...` - `useContext` seems to be null, and even
without the changes it still crashes).

This works by checking if the file is an edge function in Next.js's
Webpack plugin `TraceEntryPointsPlugin`, if true then output the nft
file to the output path, if not move up a folder like previously. I
tried changing Webpack config's output.path from `path: !dev &&
isNodeServer ? path.join(outputPath, 'chunks') : outputPath` to `path:
!dev && (isNodeServer || isEdgeServer) ? path.join(outputPath, 'chunks')
: outputPath`, but it just causes the build script to crash because
files like middleware-manifest.json are output to outputPath/chunks
instead of the expected outputPath. So I find this to be the better
solution.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-23 18:56:11 -08:00
..
app Fix edge function req.url handling with rewrite (#41139) 2022-10-03 21:05:12 +00:00
index.test.ts Fix outputting un-necessary trace files for edge functions (#43304) 2022-11-23 18:56:11 -08:00