Using reference implementation in client-side CommonJS environment

I’ve been pulling in the JS reference implementation into my web app (https://serenenotes.hominidsoftware.com/) for a year now. Thanks; that works great!

Now a framework change forces me to use CommonJS style requires. I can call
commonmark = require('./commonmark') but then it wants to pull in all the modules that commonmark pulls in: node, common, inlines, mdurl/encode, mdurl/decode, entities, etc.

So, what is the correct way to use the reference implementation in a CommonJS environment that isn’t Node.js?

Use dist/commonmark.js from the repository (or the minimized version). It has no dependencies.

That’s what I’ve been using. dist/commonmark.js works fine imported from a script tag, but can’t be loaded using
commonmark = require('./commonmark')

Fortunately, I can run npm install commonmark and then use
commonmark = require('../node_modules/commonmark')