Rollup and module in package.json

Hey, in another part of our project, not related to prosemirror, we recently switched successfully from browserify to rollup which also significantly decreased the size of our JS bundle. One of the reasons this seemed to be possible was that rollup directly used the ES6 sources of our dependencies by looking for the “module” entry in the package.json file and it did then some “tree shaking” to leave out those parts that really are not used.

Looking at the ProseMirror package.json files, it looks like you do not have a “module” entry for the ES6 sources. I was wondering: Is there a particular reason for this? Or is there just something I didn’t get?

1 Like

There’s still a lot of confusion about that ES6-era NPM modules should look like, and as far as I know, the module field was a unilaterally proposed, poorly formalized idea by Rollup’s author without any real agreed-on convention behind it. So last time I looked, it didn’t feel solid enough to start supporting it. If that has changed in the meantime, feel free to point me at relevant resources.

Bundling ProseMirror through the rollup-plugin-commonjs plugin works very well, and is what I’ve been doing in demos.