feat: pre-compile ui and richtext-lexical with react compiler (#7688)

This noticeably improves performance in the admin panel, for example
when there are multiple richtext editors on one page (& likely
performance in other areas too, though I mainly tested rich text).

The babel plugin currently only optimizes files with a 'use client'
directive at the top - thus we have to make sure to add use client
wherever possible, even if it's imported by a parent client component.

There's one single component that broke when it was compiled using the
React compiler (it stopped being reactive and failed one of our admin
e2e tests):
150808f608
opting out of it completely fixed that issue

Fixes https://github.com/payloadcms/payload/issues/7366
This commit is contained in:
Alessio Gravili
2024-08-19 17:31:36 -04:00
committed by GitHub
parent adf2f31178
commit ebd43c7763
182 changed files with 897 additions and 587 deletions

View File

@@ -27,30 +27,7 @@
],
"baseUrl": ".",
"paths": {
"@payloadcms/ui": ["../packages/ui/src/exports/client/index.ts"],
"@payloadcms/ui/shared": ["../packages/ui/src/exports/shared/index.ts"],
"@payloadcms/ui/scss": ["../packages/ui/src/scss.scss"],
"@payloadcms/ui/scss/app.scss": ["../packages/ui/src/scss/app.scss"],
"@payloadcms/next/*": ["./packages/next/src/exports/*.ts"],
"@payloadcms/richtext-lexical/client": [
"./packages/richtext-lexical/src/exports/client/index.ts"
],
"@payloadcms/richtext-lexical/generateComponentMap": [
"./packages/richtext-lexical/src/utilities/generateComponentMap.tsx"
],
"@payloadcms/richtext-slate/client": [
"./packages/richtext-slate/src/exports/client/index.ts"
],
"@payloadcms/richtext-slate/generateComponentMap": [
"./packages/richtext-slate/src/generateComponentMap.tsx"
],
"@payload-config": ["./_community/config.ts", "./versions/config.ts"],
"@payloadcms/plugin-seo/client": ["./packages/plugin-seo/src/exports/client.ts"],
"@payloadcms/plugin-stripe/client": ["./packages/plugin-stripe/src/exports/client.ts"],
"@payloadcms/plugin-search/client": ["./packages/plugin-search/src/exports/client.ts"],
"@payloadcms/plugin-form-builder/client": [
"./packages/plugin-form-builder/src/exports/client.ts"
]
"@payload-config": ["./_community/config.ts"]
}
},
"exclude": [