The Markdown parser does not seem to work when CodeMirror is loaded via a CDN

Hi there. I recently discovered that CodeMirror is behaving differently when running from a CDN (tested with jsDelivr’s ESM CDN). When run via the normal NPM installation and imports, the text is tokenized just fine. When run from the CDN, the text is not tokenized (I used Markdown for this example).

The CDN version is enabled in the linked demo, but you can see the normal installation by swapping the commented import statements.

A lot of stuff in CodeMirror doesn’t work when loading through a CDN, because those tend to load multiple versions of packages that are depended on from multiple other packages.

Following up here, seems to work without any extra configuration or specialized bundling.

I tried to look into things in more detail, comparing UNPKG, JSDelivr, and Skypack.

Thus far only I only got to work.

Full details available at: Loading CodeMirror through a CDN · GitHub

1 Like

I managed to get JSDeliver working as well: JSDelivr CodeMirror Example

For skypack there is an open issue.