home.social

#commonjs — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #commonjs, aggregated by home.social.

  1. It's almost 2026 and we are still dealing with #commonjs vs #ESM issues in #nodejs. 2026 will be the last year that Keyv (keyv.org ) attempts to support commonjs with v6 due out this year. In 2027 we will move to ESM only with v7. It is just too painful to support commonjs compatibility.

    This will also mean that `cache-manager`, `cacheable`, etc... will all move to ESM only in 2027. That is a large amount of caching usage across projects.

    #typescript #javascript

  2. Пока, dual packaging: в каком формате публиковать npm-библиотеки

    Уже 10 лет в JS-экосистеме воюют два формата модулей: CommonJS и ES Modules. Чтобы и получить плюшки ESM, и не распугать пользователей, npm-пакеты часто используют dual packaging: собирают код в оба формата. Это решает одну проблему, но создает несколько новых. Сегодня расскажу Какие проблемы пришли к dual packaging, и не пора ли от него отказаться. В какой формат паковать npm-библиотеки в 2025 году. Статься будет полезна и для опенсорса, и для внутренних библиотек, и для простых разработчиков (хотя бы чтобы понимать, откуда у вас в node_modules 2 Гб).

    habr.com/ru/articles/933754/

    #npm #esm #nodejs #commonjs #javascript #opensourse

  3. [Перевод] Публикация пакета npm с ESM и TypeScript

    За последние 2 года поддержка ESM в TypeScript, Node.js и браузерах сильно улучшилась. В этой статье я объясню мою современную настройку, которая является относительно простой по сравнению с тем, что нам приходилось делать раньше: она предназначена для пакетов, которые могут пренебречь обратной совместимостью. Настройка хорошо работает для меня некоторое время — начиная с TS 4.7 (24.05.2022) помогает то, что Node.js теперь поддерживает require(esm) — запрос библиотек ESM из модулей CommonJS я использую только tsc , но упоминаю поддержку других инструментов в разделе "Компиляция TS с помощью других инструментов" Обратная связь приветствуется: что вы делаете по-другому? Что может быть улучшено? Пример пакета: в @rauschma/helpers используется настройка, описываемая в этой статье.

    habr.com/ru/companies/timeweb/

    #timeweb_статьи_перевод #javascript #typescript #ts #npm_package #npm_registry #npm #esm #commonjs #реестр_npm #пакет_npm

  4. [Перевод] Публикация пакета npm с ESM и TypeScript

    За последние 2 года поддержка ESM в TypeScript, Node.js и браузерах сильно улучшилась. В этой статье я объясню мою современную настройку, которая является относительно простой по сравнению с тем, что нам приходилось делать раньше: она предназначена для пакетов, которые могут пренебречь обратной совместимостью. Настройка хорошо работает для меня некоторое время — начиная с TS 4.7 (24.05.2022) помогает то, что Node.js теперь поддерживает require(esm) — запрос библиотек ESM из модулей CommonJS я использую только tsc , но упоминаю поддержку других инструментов в разделе "Компиляция TS с помощью других инструментов" Обратная связь приветствуется: что вы делаете по-другому? Что может быть улучшено? Пример пакета: в @rauschma/helpers используется настройка, описываемая в этой статье.

    habr.com/ru/companies/timeweb/

    #timeweb_статьи_перевод #javascript #typescript #ts #npm_package #npm_registry #npm #esm #commonjs #реестр_npm #пакет_npm

  5. [Перевод] Публикация пакета npm с ESM и TypeScript

    За последние 2 года поддержка ESM в TypeScript, Node.js и браузерах сильно улучшилась. В этой статье я объясню мою современную настройку, которая является относительно простой по сравнению с тем, что нам приходилось делать раньше: она предназначена для пакетов, которые могут пренебречь обратной совместимостью. Настройка хорошо работает для меня некоторое время — начиная с TS 4.7 (24.05.2022) помогает то, что Node.js теперь поддерживает require(esm) — запрос библиотек ESM из модулей CommonJS я использую только tsc , но упоминаю поддержку других инструментов в разделе "Компиляция TS с помощью других инструментов" Обратная связь приветствуется: что вы делаете по-другому? Что может быть улучшено? Пример пакета: в @rauschma/helpers используется настройка, описываемая в этой статье.

    habr.com/ru/companies/timeweb/

    #timeweb_статьи_перевод #javascript #typescript #ts #npm_package #npm_registry #npm #esm #commonjs #реестр_npm #пакет_npm

  6. [Перевод] Публикация пакета npm с ESM и TypeScript

    За последние 2 года поддержка ESM в TypeScript, Node.js и браузерах сильно улучшилась. В этой статье я объясню мою современную настройку, которая является относительно простой по сравнению с тем, что нам приходилось делать раньше: она предназначена для пакетов, которые могут пренебречь обратной совместимостью. Настройка хорошо работает для меня некоторое время — начиная с TS 4.7 (24.05.2022) помогает то, что Node.js теперь поддерживает require(esm) — запрос библиотек ESM из модулей CommonJS я использую только tsc , но упоминаю поддержку других инструментов в разделе "Компиляция TS с помощью других инструментов" Обратная связь приветствуется: что вы делаете по-другому? Что может быть улучшено? Пример пакета: в @rauschma/helpers используется настройка, описываемая в этой статье.

    habr.com/ru/companies/timeweb/

    #timeweb_статьи_перевод #javascript #typescript #ts #npm_package #npm_registry #npm #esm #commonjs #реестр_npm #пакет_npm

  7. #Javascript seems like such a fucking mess when the way you're importing libraries can somehow vary for wtv reason??? I also can never quite comprehend wth's an #ESM or #CommonJS ​:frierencrying:​

  8. @tolmasky the amount of times I had to learn what is #CommonJS and what is #ESM to then forget it and get bitten again when I come to #JS is bleak in comparison, I'm sure, but it made me make a video (mostly for myself) to later watch: youtube.com/watch?v=SIows5N4BA

    😆

  9. Spent tonight learning #11ty and working on jameskerrane.com

    - Updated to @eleventy v3.0.0! 🥳
    - Refactored project files to switch from #CommonJS syntax to the newly supported and standardized #ESM modules
    - Streamlined how the site handles images
    - Started work on moving away from #nunjucks for templates to liquid or something else
    - Renamed the repository

    The nature of all of these changes is that the site doesn't look different, but the developer experience is cooler! 🚀

  10. Want to know why #CommonJS was a mistake?
    One phrase. Conditional #module #exports.

    if (condition) {
    module.exports = foo
    } else {
    module.exports = bar
    }

    #javaScript #nodejs #cjs #js #webDev #esm #modules

  11. Управление зависимостями в Javascript заходит на новый виток? Работа с ES модулями без сборщиков

    Изначально эта статья задумывалась, как рассказ о различиях и назначении полей dependencies , devDependencies и peerDependencies в package.json . Эту тему выбрали ребята в моем телеграм-канале , кстати подписывайтесь, если еще не. Однако, когда я посмотрел количество контента на эту тему, то понял, что его достаточно даже в русском сегменте. При этом я прочитал одну статью , которая показалась мне очень хорошей, а также там были мысли на тему будущего управления зависимостями. В итоге, я решил кратко пересказать вышеупомянутую статью, чтобы лучше самому усвоить тему, а также набросать проект по управлению зависимостями прямо на клиенте, через ES Modules. Так что вы можете прочитать либо оригинальную и полную статью у автора, либо сокращенную версию в первой половине этой статьи. А разбор работы ESM будет во второй половине .

    habr.com/ru/articles/825424/

    #npm #yarn #pnpm #javascript #node #esm #commonjs #dependency_management #package_manager

  12. Is it wrong if I'm kind of enjoying the drama about #ljharb?
    Burn tc39 down! Make the web anew!
    The only standard is death comes to everything!

    #webDev #javaScript #tc39 #nodejs #esm #esmodules #commonjs #cjs #modules

  13. > enough libraries use ES Modules that for many projects you need to either use ES Modules, or figure out how to interoperate ES Modules with your CommonJS code. At the same time, enough code still uses CommonJS that you often need to figure out how to include that legacy code in your otherwise-ES Module project.

    borischerny.com/javascript,/ty

    #javaScript #nodeJS #esModules #webdev #web #typescript #esm #cjs #commonjs #package #npm

  14. Learn to create libraries compatible with both ESM and CommonJS, as well as different runtimes like Node.js, Deno, and browsers.

    #deno #bun #node #esm #commonjs #javascript

    hexagon.56k.guru/posts/dual-mo

  15. A new post on how to create a React components library, although focusing on the aspects of publishing dual libraries (CJS+ESM) with types: blog.coderspirit.xyz/blog/2023

    #JavaScript #TypeScript #ESM #CommonJS

  16. As supporting both and can be wrongly done in a thousand ways, I published why and how we achieved that on fast-check.

    This article is a follow-up of issues reported via from @bluwy and fixed thank to @AndaristRake. As making the package right was not an easy game at first glance, I thought that a how-we-do article could help other .

    Link to the article: fast-check.dev/blog/2023/09/04

  17. As supporting both #CommonJS and #ESModules can be wrongly done in a thousand ways, I published why and how we achieved that on fast-check. #JavaScript #opensource

    This article is a follow-up of issues reported via #publint from @bluwy and fixed thank to @AndaristRake. As making the package right was not an easy game at first glance, I thought that a how-we-do article could help other #maintainers.

    Link to the article: fast-check.dev/blog/2023/09/04

  18. As supporting both #CommonJS and #ESModules can be wrongly done in a thousand ways, I published why and how we achieved that on fast-check. #JavaScript #opensource

    This article is a follow-up of issues reported via #publint from @bluwy and fixed thank to @AndaristRake. As making the package right was not an easy game at first glance, I thought that a how-we-do article could help other #maintainers.

    Link to the article: fast-check.dev/blog/2023/09/04

  19. As supporting both #CommonJS and #ESModules can be wrongly done in a thousand ways, I published why and how we achieved that on fast-check. #JavaScript #opensource

    This article is a follow-up of issues reported via #publint from @bluwy and fixed thank to @AndaristRake. As making the package right was not an easy game at first glance, I thought that a how-we-do article could help other #maintainers.

    Link to the article: fast-check.dev/blog/2023/09/04

  20. As supporting both #CommonJS and #ESModules can be wrongly done in a thousand ways, I published why and how we achieved that on fast-check. #JavaScript #opensource

    This article is a follow-up of issues reported via #publint from @bluwy and fixed thank to @AndaristRake. As making the package right was not an easy game at first glance, I thought that a how-we-do article could help other #maintainers.

    Link to the article: fast-check.dev/blog/2023/09/04

  21. @GabeMoralesVR I am a complete newbie of Javascript. Modules have created a lot of difficulties as I do not yet understand how they work and the documentation is confusing as some Emscripten exemples refer to #CommonJS whereas browsers prefer #ES6.

  22. In 2009, #CommonJS was exactly what #JavaScript needed. The group took a tough problem and forced through a solution that continues to be used millions of times a day.

    But with #ESM as the standard and the focus shifting towards cloud primitives — the edge, browsers, and #serverless compute — and CommonJS simply doesn’t cut it. ESM is a better solution for developers, as they can write browser-compliant code — and for users who get a better end experience.

    deno.com/blog/commonjs-is-hurt

    #webDev

  23. Should I transpile this code? I really want to use Typescript and new JS features?

    Do I want to support #ESModules and #CommonJS? Should I bundle this code? What about #Node vs. #Deno Browser vs. compatibility?

  24. I am creating a library using #typescript I would like to generate using the same codebase a valid #deno import, an #javascript #ESM module and #CommonJS module for maximum compatibility. Does anyone have a magic tsconfig configuration in the best case, or any idea about an easy solution to achieve this?