-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you use lowlight with hljs v11 support with cjs/node? #37
Comments
No, there is not. ll with hl@11 can be used currently by depending on You’ll have a couple problem with rehype-highlight and ll@main for now, but that’ll be solved when hl@11 is released. You could bundle them and use that bundle. But I’d suggest switching to ESM |
gotchya -- so I really just need hljs v11 to be released so all the the remark/rehype packages ship cjs in npm. Thoughts on bundling the dist files on the
if I weren't integrating with an existing node ecosystem, this'd be an option! But I'd have to convert thousands of files and maybe hundreds of packages to ESM before I could finally use lowlight via ESM |
remark/rehype will turn to ESM soon too, and stop shipping ESM
Against it. Dual publishing has a lot of problems too.
I’ve ported 200 projects over already. And will port 200+ more over these months. It’s a lot of work. But it’s the future. Also: ESM can use CJS just fine. You can port one project over that depends on CJS without a problem |
Yeah, my issue is more that I need the other way around to work :(
what problems?
I mean, if breaking changes are what get all of the node ecosystem to move to ESM, that's great. This feels like an awkward transitional period where we don't have forwards compatibility though (only backwards compatibility) |
Say you depend on project a and b. A and b depend on project C. But a is cjs and b is esm. Now you ship ywo different copies of C. They might just duplicate code size. Or they might interfere. That's quite a problem. In practice, I've also noted this. I shipped micromark half a year back as dual. And it broke a ton of folks on webpack 4, which can't deal with it properly. Tooling needs to catch up to esm. And it's not going to be easy. But the only path forward I can see is making that cut and switching |
With different package.json entries for
agree with ya there |
Please don't keep reminding me of dual packaging problems. ;-) |
Closing this as there’s I’m not going to add CJS support here, and I’ll release the code on |
I see that the package is built with
target: ES2020
, which is great! except that node/CJS is still a mess with cjs<->module compatibilityif I want to use Node/cjs, how do I use lowlight / rehype-highlight? Is there a way to tell rehype, and/or maybe remark to not use lowlight, and use highlight directly?
The text was updated successfully, but these errors were encountered: