#commonjs

Frontend Dogmafrontenddogma@mas.to
2025-05-18

Building the Bridge: Running JavaScript Modules From Dart, by (not found on Mastodon or Bluesky):

globe.dev/blog/building-the-br

#javascript #modules #esm #commonjs #dart #deno

2025-03-12

[Перевод] Публикация пакета 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

#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:​

Jons Mostovojsjonn@social.doma.dev
2025-01-08

@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

😆

James Kerranethatrobotdev
2024-12-24

Spent tonight learning and working on jameskerrane.com

- Updated to @eleventy v3.0.0! 🥳
- Refactored project files to switch from syntax to the newly supported and standardized modules
- Streamlined how the site handles images
- Started work on moving away from 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! 🚀

Screenshot of the homepage of https://www.jameskerrane.com.

A navbar at the top shows the selected "Home" page and a "Blog" link. A callout box says, "Hello, website visitor! This website is under active construction, so please check me out on other platforms as I port information to this new site! Thank you very much." The callout box then includes a bulleted list. Item 1: Interested in my professional history? Please visit my LinkedIn profile. Item 2: Interested in my current projects? Please check out my GitHub profile! Item 3: Interested in connecting? Please email me at jkerrane3@gatech.edu.

A header element says, "Hello, I'm James Kerrane, a first-year Computer Science student at Georgia Tech and a maker."

A resume is embedded into the site in a document reader, with the top visible listing contact information. Address Line 1: 329722 Georgia Tech Station. 351 Ferst Dr NW, Atlanta, GA 303322 [sic.]-1400. github.com/thatrobotdev. linkedin.com/in/jameskerrane. jameskerrane.com.
🧿🪬🍄🌈🎮💻🚲🥓🎃💀🏴🛻🇺🇸schizanon
2024-08-26

Want to know why was a mistake?
One phrase. Conditional .

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

🧿🪬🍄🌈🎮💻🚲🥓🎃💀🏴🛻🇺🇸schizanon
2024-08-13
2024-06-28

Управление зависимостями в 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

🧿🪬🍄🌈🎮💻🚲🥓🎃💀🏴🛻🇺🇸schizanon
2024-06-26

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

🧿🪬🍄🌈🎮💻🚲🥓🎃💀🏴🛻🇺🇸schizanon
2024-06-25

> 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

2024-06-07

Mixed Imports: Loading JSON Directly in TypeScript and ES Modules link.medium.com/GU8QNAZOeKb

#typescript #javascript #ecmascript #commonjs #cdk

🧿🪬🍄🌈🎮💻🚲🥓🎃💀🏴🛻🇺🇸schizanon
2024-04-25

> Support for require()ing ESM graphs is now exposed by default in Node.js 22

openjsf.org/blog/nodejs-22-ava

Javascript / NodeJS

Did you ever get an annoying error message while trying to access __dirname in a #javascript module running #node ?

__dirname and __filename were global variables in the old #CommonJS so they never worked when using proper modern js modules.

You had to write some ugly extra helper code to get this functionality.

Well, it's now fixed! As of node version 20.11.0 you can use

import.meta.filename
import.meta.dirname

sonarsource.com/blog/dirname-n

#programming #code #nodejs

洪 民憙 (Hong Minhee) 🤏🏼hongminhee@todon.eu
2024-03-30

Progress report, March 30, 2024.

I tried #CommonJS packaging, but it turned out to be quite challenging, so I decided to support #ESM only.

I got #Fedify packaged into npm using #dnt, but it hasn't been published to npm yet.

I've made the entire unit test pass in Node.js now.

It was pre-released to JSR as version 0.5.0-dev.86+31d077e4, and you can test it out: jsr.io/@fedify/fedify@0.5.0-de

github.com/dahlia/fedify/discu

Screenshot: All unit tests passing in Node.js.
2023-12-22

[Action Required] AWS Lambda end of support for Node.js 16
-> Upgrading Node.js Lambdas above v18 or v20

link.medium.com/VTMEs1YSJFb

#aws #lambda #nodejs #javascript #commonjs #ecmascript

Braw ☕🏳️‍🌈brawaru@mstdn.social
2023-10-16

The only thing I miss from #CommonJS imports is ability to have optional dependencies.

```js
let dep = null;
try {
dep = require('opt-dep')
} catch {}
```

The closest thing in #ESM you can get is import via top-level await, but it's not always available and causes all sorts of funky things.

Hexagon :github:hexagon@social.56k.guru
2023-09-25

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

Andreu Casablanca 🐀castarco@hachyderm.io
2023-09-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

lil5 :golang: 🚲 🇳🇱lil5@fosstodon.org
2023-09-12
2023-09-04

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

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst