question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discuss: CDN builds should include ESM ready modules

See original GitHub issue

We already have a ton of infrastructure, history, documentation around making our web builds available via CDN (and secondarily) via NPM via con-assets… if we do have an ESM library that is intended for use on the web then it should be built with cdn and packaged along with the CJS version in our CDN distribution. It would be very strange for it to not be included there. That may require some additional work/thought… so if you want to have that discussion…

_Originally posted by @joshgoebel in https://github.com/highlightjs/highlight.js/pull/3188#issuecomment-844207270_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
joshgoebelcommented, May 30, 2021

@aduh95 If you’re interesting I think this is quite likely as simple and taking the ESM build code I removed from node build before and migrating it over to the cdn build…

0reactions
joshgoebelcommented, Apr 14, 2022

I would like a very minimal cdn bundle…

This bundle already exists (CDN build): es/core.js

I would also want an async version

This currently does not exist. This would require several complexities be resolved before it could exist in core:

  • whole new async API for highlight* and perhaps registerLanguage / getLanguage
  • nested grammar dependencies also need to “just work” (http -> html -> (css/js)), including circular dependencies (html => js => html)
  • need a way to extract & register aliases at compile time rather than runtime (aliases are currently unknown until AFTER grammars are loaded)
  • need a way to specify which grammars a person does NOT ever want to load

I’m probably forgetting things, you’d have to skim several of these threads - I’ve definitely written on this subject before.

Also, see #2405. Right now I’m unconvinced that this isn’t better handled by a wrapper outside of core such as say a new highlightjs-async library that simply wrapped the core library with async niceness. (you’d have to handle aliases and the dependency graph, plus a nice async wrapper)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pika Project Launches New JavaScript CDN to Serve Modern ...
Pika Project Launches New JavaScript CDN to Serve Modern, ESM Packages ... the results will only include those that have a defined “module” ......
Read more >
Pure ESM package - gists · GitHub
CDN's that allow packages to be imported via URL for browsers or Deno have to do more fiddly work to convert all the...
Read more >
ArcGIS API for JavaScript – Learn About ES Modules - Esri
This post discusses some of the differences between AMD and ESM, there's a hands-on tutorial to help you build your first app, then...
Read more >
Module Federation - webpack
Each build acts as a container and also consumes other builds as containers. This way, each build is able to access any other...
Read more >
Import non-ESM libraries in ES Modules, with client-side ...
Once you start using ESM, you realize that most libraries out there are not written in ESM, nor do they include ESM builds....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found