rsnext/test/development/basic
Jiachi Liu a2dc530f44
Separate next/dynamic implementation for app and pages (#45565)
## Issue

To address the problem that we introduced in 13.0.7 (#42589) where we thought we could use same implementation `next/dynamic` for both `pages/` and `app/` directory. But it turns out it leads to many problems, such as:

* SSR preloading could miss the content, especially with nested dynamic calls
  * Closes #45213
* Introducing suspense boundary into `next/dynamic` with extra wrapped `<Suspense>` outside will lead to content is not resolevd during SSR
  * Related #45151
  * Closes #45099
* Unexpected hydration errors for suspense boundaries. Though react removed this error but the 18.3 is not out yet.
  * Closes #44083
  * Closes #45246
 
## Solution

Separate the dynamic implementation for `app/` dir and `pages/`. 

For `app/` dir we can encourage users to: 
  * Directly use `React.lazy` + `Suspense` for SSR'd content, and `next/dynamic` 
  * For non SSR components since it requires some internal integeration with next.js.

For `pages/` dir we still keep the original implementation

If you want to use `<Suspense>` with dynamic `fallback` value, use `React.lazy` + `Suspense` directly instead of picking up `next/dynamic` 
  * Closes #45116

This will solve various issue before react 18.3 is out and let users still progressively upgrade to new versions of next.js.

## Bug Fix

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
2023-02-04 01:45:35 +00:00
..
define-class-fields feat:Add support for useDefineForClassFields typescript option (#36335) 2022-04-21 10:41:09 +02:00
emotion-swc Stabilize SWC emotion transform plugin (#37058) 2022-05-21 04:09:30 +00:00
gssp-ssr-change-reloading Fix disposing active entries in dev compilers (#39845) 2022-08-23 07:23:43 +00:00
hmr hmr error improvements (#30616) 2023-01-06 20:35:16 +01:00
legacy-decorators Add support for legacy decorators through tsconfig/jsconfig (#31376) 2021-11-13 18:26:13 +01:00
misc BREAKING CHANGE: Enable newNextLinkBehavior (#41459) 2022-10-17 21:20:28 -04:00
next-dynamic Fix dynamic no ssr with babel transform (#45091) 2023-01-23 13:39:47 -08:00
node-builtins Add support for node: prefix when importing Node.js builtin modules (#45149) 2023-01-23 14:16:35 +01:00
styled-components feat: enable styled-components css prop swc transform by default (#37962) 2022-06-23 18:08:22 +00:00
styled-components-disabled Add test for styled-components SWC transform disabled (#31214) 2021-11-09 17:18:04 +01:00
tailwind-jit Fixes #33153: Updating cross-references from master to main + canary (#33198) 2022-01-12 02:55:35 +01:00
theme-ui Add support for jsxImportSource in tsconfig/jsconfig (#31358) 2021-11-12 21:51:43 +01:00
define-class-fields.test.ts Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00
emotion-swc.test.ts Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00
hmr.test.ts Update swc_core to v0.56.0 (#44792) 2023-01-20 10:34:09 -08:00
legacy-decorators.test.ts Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00
misc.test.ts Migrate basic-basepath tests into basic (#44776) 2023-01-11 08:13:19 -08:00
next-dynamic.test.ts Separate next/dynamic implementation for app and pages (#45565) 2023-02-04 01:45:35 +00:00
node-builtins.test.ts Add support for node: prefix when importing Node.js builtin modules (#45149) 2023-01-23 14:16:35 +01:00
project-directory-rename.test.ts Add project directory rename/remove handling (#44911) 2023-01-18 14:37:40 -08:00
styled-components-disabled.test.ts Remove extra styled-components disabled test (#44870) 2023-01-13 16:26:33 -08:00
styled-components.test.ts Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00
tailwind-jit.test.ts Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00
theme-ui.test.ts Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00