Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next.js: Compat with React 19 types #1

Closed
wants to merge 4 commits into from
Closed

Conversation

eps1lon
Copy link
Owner

@eps1lon eps1lon commented Mar 21, 2024

Closes eps1lon/DefinitelyTyped#20

Changes

Almost all where codemoddable. I decided against using react-element-default-any-props since that would've changed way more usages (15 files) than were necessary (1 file).

One useReducer breakage that makes it more "vanilla". Good breakage in my book since you don't need to learn about React.Reducer now.

One wrong application of scoped-jsx because we add the import globally which is incorrect in an ambient context. The imports should go into declare module: eps1lon/types-react-codemod#372

Unresolved Issues

```bash
$ npx types-react-codemod preset-19 packages --ignore-pattern "**/{node_modules,dist,.turbo}/**"
Processing 1304 files...
Results:
0 errors
1278 unmodified
0 skipped
26 ok

$ npx types-react-codemod preset-19 test --ignore-pattern "**/{node_modules,dist,.turbo}/**"
Processing 1687 files...
Results:
0 errors
1666 unmodified
1 skipped
20 ok
```
The codemod affected 15 files while we only had to change a single file.
Confirms that this codemod should really be off by default.
Cautionary advise against it should be stronger.
@eps1lon eps1lon marked this pull request as ready for review March 21, 2024 14:11
@eps1lon eps1lon self-assigned this Mar 21, 2024
@eps1lon
Copy link
Owner Author

eps1lon commented Mar 21, 2024

Finished. Contributed to eps1lon/DefinitelyTyped#25 and eps1lon/DefinitelyTyped#25

@eps1lon eps1lon closed this Mar 21, 2024
@eps1lon eps1lon changed the title Compat with React 19 types next.js: Compat with React 19 types Mar 21, 2024
@eps1lon eps1lon mentioned this pull request May 13, 2024
22 tasks
eps1lon pushed a commit that referenced this pull request Aug 21, 2024
…etPrefix (vercel#68694)

This PR fixes two issues with the use of `assetPrefix`:

#1: vercel#64710
`assetPrefix` needs to be handled in `dev`, `deploy`, and `start`. In
the current approach, only `dev` and `start` were handled, but a quirk
of the implementation caused rewrites for non-asset paths to not be able
to be used in `afterFiles` rewrites.

vercel#2: When deploying Next.js (such as on Vercel), you need to add your own
`beforeFiles` rewrite for `/${assetPrefix}/_next/...` requests or
otherwise they would 404.

This PR creates an automatically added `rewrite` to `beforeFiles` that
handles the case for `dev`, `start`, and `deploy`, removes the existing
logic in `filesystem.ts`, and adds more tests to check the behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

React 19 and Next.js
1 participant