Plate publishes ESM entrypoints with an exports map. Configure TypeScript
to read that map so imports such as platejs/react resolve to the matching
declarations and runtime files.
For Vite, Next.js, and other bundlers, use moduleResolution: "bundler"
with an ESM module target:
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "preserve",
"strict":
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "preserve",
"strict": true,
"noEmit": true
}
}Keep the other settings supplied by your framework. The bundler resolution
mode requires TypeScript 5.0 or later.
For code executed directly by Node.js, pair NodeNext module resolution
with the same module setting:
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true
}
}{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true
}
}Declare "type": "module" in your application's package.json when emitting
ESM from .ts files. Follow the Node.js guide
for server-safe Plate imports.
Import from the published entrypoint:
import { createEditor } from 'platejs';import { createEditor } from 'platejs';Use platejs/react for editable React APIs and platejs/static for
static React rendering. Import feature subpaths only when the installed
package exports them.
Keep application aliases such as @/* in your framework configuration.
Do not alias Plate imports to node_modules/platejs/dist: the export map
owns the relationship between a public subpath and its files, and those
paths do not all share the same directory layout.
platejs is installed in the
workspace that imports it and that TypeScript uses the intended config.exports map and
use bundler or NodeNext resolution.Use the troubleshooting guide to inspect installed versions and runtime duplication.