Commit 4a6b511
committed
Fix next/image usage in mdx (#64875)
### What
Apply the react aliases for app dir also to the files with
`pagesExtension`
### Why
In the page bundle of mdx page:
In RSC layer react is referencing to the insatlled react 18.2.0 's
`jsx-runtime` to create each JSX element. The react 18.2 JSX runtime
access `propTypes` of the component type and then it crashes 💥
In RSC layer it should use the built-in react canary's `jsx-runtime`.
The reason that it didn't use the built-in one is we're using customized
`pageExtension` `["mdx"]` for mdx, where we didn't apply all these rules
for the files with `pageExtension`, but only the js and ts files by
default.
For mdx specifically, we cannot only applied to
`(page|layout|route).[page extension]` cause every mdx file needs to
have proper resolution. Since this doesn't break transform, it's safe to
apply for all files with page extension.
Fixes #58888
Closes NEXT-31871 parent 04cc13c commit 4a6b511
File tree
5 files changed
+22
-4
lines changed- packages/next/src/build
- test
- e2e/app-dir/mdx
- app/image
- public
5 files changed
+22
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
819 | 819 | | |
820 | 820 | | |
821 | 821 | | |
| 822 | + | |
822 | 823 | | |
823 | 824 | | |
824 | 825 | | |
| |||
840 | 841 | | |
841 | 842 | | |
842 | 843 | | |
| 844 | + | |
| 845 | + | |
843 | 846 | | |
844 | 847 | | |
845 | 848 | | |
| |||
1326 | 1329 | | |
1327 | 1330 | | |
1328 | 1331 | | |
1329 | | - | |
| 1332 | + | |
1330 | 1333 | | |
1331 | 1334 | | |
1332 | 1335 | | |
| |||
1388 | 1391 | | |
1389 | 1392 | | |
1390 | 1393 | | |
1391 | | - | |
| 1394 | + | |
1392 | 1395 | | |
1393 | 1396 | | |
1394 | 1397 | | |
| |||
1405 | 1408 | | |
1406 | 1409 | | |
1407 | 1410 | | |
1408 | | - | |
| 1411 | + | |
1409 | 1412 | | |
1410 | 1413 | | |
1411 | 1414 | | |
| |||
1418 | 1421 | | |
1419 | 1422 | | |
1420 | 1423 | | |
1421 | | - | |
| 1424 | + | |
1422 | 1425 | | |
1423 | 1426 | | |
1424 | 1427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
| |||
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1795 | 1795 | | |
1796 | 1796 | | |
1797 | 1797 | | |
| 1798 | + | |
1798 | 1799 | | |
1799 | 1800 | | |
1800 | 1801 | | |
| |||
0 commit comments