File tree Expand file tree Collapse file tree
packages/starboard-notebook Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,17 @@ const baseConfig = {
3535 "react" : resolvePackageDir ( "preact/compat" ) ,
3636 "react-dom" : resolvePackageDir ( "preact/compat" ) ,
3737 "markdown-it" : resolvePackageDir ( "markdown-it" ) ,
38- "prosemirror-view" : resolvePackageDir ( "prosemirror-view" ) ,
38+ // prosemirror-state and prosemirror-view each ship both a CJS and ESM
39+ // build. Webpack 5 loads the ESM build for `import` statements and the
40+ // CJS build for `require()` calls (e.g. from rich-markdown-editor's
41+ // pre-built dist files). Each build has its own module-level `keys`
42+ // counter, so anonymous plugins from the two builds end up with the
43+ // same string key (e.g. "plugin$1"), causing the
44+ // "Adding different instances of a keyed plugin" error at runtime.
45+ // Pointing the alias at the exact CJS file forces webpack to bundle
46+ // only a single copy regardless of import style.
47+ "prosemirror-state" : require . resolve ( "prosemirror-state" ) ,
48+ "prosemirror-view" : require . resolve ( "prosemirror-view" ) ,
3949 "katex" : resolvePackageDir ( "katex" ) ,
4050 } ,
4151 fallback : { "assert" : require . resolve ( "assert/" ) }
You can’t perform that action at this time.
0 commit comments