How do I bundle prosemirror-example-setup and use in the browser?



I installed the npm package prosemirror-example-setup. There is a file dist/index.js but this doesn’t seem suitable to include in the browser.

Are there simple steps to bundle this with a basic editor and include in the browser?

There is already a rollup config there, can I not re-purpose it to include an editor and bundle a browser friendly .js file?

Thanks, Bahadir


You have to use a bundler such as Rollup, Webpack, or Browserify to combine the various ProseMirror modules (example-setup doesn’t include the rest of the library) into a browser-loadable file.


I created a bare minimal webpack bundle for anyone interested in getting started with prosemirror-example-setup

It doesn’t do anything other than bundle the example for inclusion in an html script tag.


For the curious, I’ve written a tutorial-ish guide on how to setup a basic ProseMirror instance.