4aa5e9cad2
### 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 |
||
---|---|---|
.. | ||
.stats-app | ||
development | ||
e2e | ||
examples | ||
integration | ||
lib | ||
production | ||
unit | ||
.gitignore | ||
build-turbopack-tests-manifest.d.ts | ||
build-turbopack-tests-manifest.js | ||
get-test-filter.js | ||
jest-setup-after-env.ts | ||
ppr-tests-manifest.json | ||
readme.md | ||
test-file.txt | ||
tsconfig.json | ||
turbopack-tests-manifest.json |