Schema is missing its top node type ('doc')

i am playing around with the library and currently encountering this issue Schema is missing its top node type ('doc') while extending the schema with the following code.

import { schema } from "prosemirror-schema-basic";
import { Schema } from "prosemirror-model";
const extendedSchema = new Schema({
    nodes: schema.spec.nodes,
    marks: schema.spec.marks        
});

am i missing something?

That precise code works for me, so I don’t know what’s going wrong. Maybe something with your module loading or bundling setup.

yup i guess you are right, i was using vuejs vite to create my app. So I retried it using Vue 2 CLI and its working. Thanks!

I am getting the same error,

RangeError: Schema is missing its top node type (‘doc’)

I just can’t seem to find out the problem, having commented it with the prosemirror command functionality

I know this is old, but surprised there wasn’t a resolution proposed, although @marijn basically pointed the way.

The issue is caused by the instanceof check on OrderedMap.

https://github.com/marijnh/orderedmap/blob/master/index.js#L131

I just ran into it, but I recalled an earlier thread where a similar issue happened so I immediately know. Can be fixed in a few ways, and is always external build set up fault. A simple alias on build to always resolve one orderedmap fixes it.

@marijn The resultant error is definitely opaque. And for the purposes of a library that I’d like to see adopted by as many people as possible, including those using LLMs, I propose that that area of the code have something of a check for this condition, similar to the other part of the code where you suggest that the modules might be different, iirc prosemirror-view or some other module, maybe state. The code past that if check gobbles up prototypes, and breaks the contract expected by prosemirror (string, obj, string, obj) etc.

Could be reliably detected, probably more sanely by you. It’s certainly not a big deal, and am OK if you don’t like the idea. My thoughts are simply that it could save other people time chasing their tail. I could propose a PR if you’d like, just let me know.