Skip to content

Commit c9022f9

Browse files
committed
Singleton was not ready to mingleton
1 parent aac8abb commit c9022f9

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

packages/starboard-notebook/webpack.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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/") }

0 commit comments

Comments
 (0)