rsnext/test/e2e/module-layer
Jiachi Liu 1415609870
Reland bunling webpack middleware changes (#66049) (#66052)
Revert the revert in #66049 

It was erroring in pages api with importing `react-dom/server` as this
is disallowed in app but shouldn't be in pages. It's caused by we're
validating middleware layer as server components but edge pages api is
still bundled in the same layer, where we shouldn't apply the check.

* Separate the api in api layers, and while handling middleware
warnings, checking api layer as well
* No need to check layers while handling externals in edge compiler
* Found a bug that we shouldn't check if `config.transpilePackages` is
defined then we enable `externalDir`, removed that condition. It fails
the telemetry tests case build with code change from this PR.


Add more tests for pages dir and middleware

|  | `react` condition | `react-dom/server` condition |
| ---- | ---- | ---- |
| middleware (edge) | react-server | not allowed, failed with dev/build
checks |
| pages/api edge | default condition | default condition |
| pages/api node | default condition | default condition |
2024-05-28 13:55:12 +02:00
..
app Allow server-only in server targets and client-only in client components targets to be available (#55394) 2023-09-18 12:27:45 +00:00
lib/mixed-lib Disable client-only for middleware and pages api layer (#55541) 2023-09-18 14:59:54 -05:00
pages Reland bunling webpack middleware changes (#66049) (#66052) 2024-05-28 13:55:12 +02:00
middleware.js Reland bunling webpack middleware changes (#66049) (#66052) 2024-05-28 13:55:12 +02:00
module-layer.test.ts Reland bunling webpack middleware changes (#66049) (#66052) 2024-05-28 13:55:12 +02:00