rsnext/test
Jiachi Liu 4aa5e9cad2
Fix next/server api alias for ESM pkg (#61721)
### What & Why

We have a modularize imports config for `next/server` before, which will
transform the `next/server` imports to directly import from the actual
file, for instance: `import { NextRequest } from 'next/server'` will
become `import { NextRequest } from
'next/dist/server/web/exports/next-request'`, where the NextRequest is
exported as default export. This is fine in most case until you're using
a ESM pkg, then it will be resolved as `{ default: NextRequest }`
according to the spec. Since it's a ESM import to a CJS module in
`next/dist`.

Since we already have the ESM alias introduced in #59852 , this can
handle the case more properly.

### How

Remove the modularize imports config for `next/server`, use the ESM api
alias instead.

Migrate the cjs optimizer tests from middleware to a separate endpoint
`/cjs/server`. As now ESM imports for next/server are not going to get
tree-shaken in dev, but since we don't have image response there it's
still fine.

Closes NEXT-2376
Closes NEXT-2374
2024-02-06 16:59:24 +00:00
..
.stats-app chore: upgrade pnpm to 8.14.2 (#60995) 2024-01-22 14:12:09 -08:00
development decode magic identifiers (#61658) 2024-02-06 10:19:07 +00:00
e2e Fix next/server api alias for ESM pkg (#61721) 2024-02-06 16:59:24 +00:00
examples feat(cli): introduce --tailwind flag (#46927) 2023-03-16 16:06:27 +01:00
integration fix(next-eslint): .eslintrc.json not being created by next lint on App Router (#55104) 2024-02-05 15:47:18 -08:00
lib Enable next.js version checker in turbopack (#61034) 2024-01-24 06:37:18 +01:00
production feat(ts): expose MiddlewareConfig interface (#61576) 2024-02-05 11:15:58 -08:00
unit chore: update ESLint and plugins to latest (#61544) 2024-02-01 20:06:02 -05:00
.gitignore ci(workflow): enable test trace upload (#51107) 2023-06-12 17:14:13 +00:00
build-turbopack-tests-manifest.d.ts Update Turbopack test manifest from GitHub Actions artifact (#58394) 2023-11-24 16:48:12 +01:00
build-turbopack-tests-manifest.js chore: skip flaky turbopack navigation test (#60431) 2024-01-09 14:25:08 +00:00
get-test-filter.js run tests from test suite that are not listed in the manifest (#58401) 2024-01-11 07:38:35 +00:00
jest-setup-after-env.ts Decrease default test timeouts (#56116) 2023-09-27 23:55:20 +00:00
ppr-tests-manifest.json ppr: ensure the router state tree is provided for interception routes (#61059) 2024-01-24 10:20:47 -08:00
readme.md
test-file.txt
tsconfig.json chore: extends from shared base tsconfig (#59776) 2023-12-19 18:52:22 +01:00
turbopack-tests-manifest.json Update Turbopack test manifest (#61707) 2024-02-06 15:19:57 +01:00

See Testing for more information on how you can run/write/debug tests for Next.js.