[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Node.js ESM support for distribution provided packages





On ചൊ, സെപ്റ്റം 26 2023 at 05:15:38 വൈകു +02:00:00 +02:00:00, Jérémy Lal <kapouer@melix.org> wrote:
CC debian-js mailing list, the right place for a start.

Le mar. 26 sept. 2023 à 14:39, Alexander Jones <alex@weej.com> a écrit :
Hi

Not sure if this is the best place to discuss, but I've noticed that upstream Node.js makes it difficult to use distribution provided packages with ESM. They break the symmetry of scripting language interpreters, and no longer look in $PREFIX/lib/node for dependencies when using ESM (vs. CommonJS).

I'm aware that all of the Node.js packaging in Debian uses this conventional approach to dependency lookup, matching e.g. Python and Perl. I believe it may be worth us discussing with the Node.js project to see if they are willing to support this without requiring patches. My organization also uses this same approach, hence me reaching out to find out what, if any, your approach may be to continue Debian packaging of Node.js when ESM becomes de facto compulsory. It'd be nice if between Debian, Red Hat, and organizations' internal distributions, there was a consistent, well-supported approach to follow.

Many thanks

For ESM modules, Debian follows a "symlink all system modules to node_modules as a flatten tree" approach, which is simple and requires no patch.
Debian does this using helpers that can be found in pkg-js-tools.

It shares some similarities with pnpm, but pnpm is much more complicated and achieves a more generic goal.
I wonder if pnpm can install symlinks by pulling packages from a "system store", though. 
We also have yarn plugin apt to allow yarn to look for apt installed modules.

Jérémy



Reply to: