Skip to content
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

Bootstrapping the initiative: TODOs? #2

Open
joyeecheung opened this issue Oct 22, 2024 · 8 comments
Open

Bootstrapping the initiative: TODOs? #2

joyeecheung opened this issue Oct 22, 2024 · 8 comments

Comments

@joyeecheung
Copy link
Member

joyeecheung commented Oct 22, 2024

A few TODOs come to mind:

  1. Starting a team for looking into the package shipping patterns. We'll need to set up contribution guidelines and team onboarding/offloading/consensus seeking. It would be great if we can get maintainers of bundlers and package automation tools involved to discuss and keep folks on the same page about the understanding of these practices.
  2. Looking into existing shipping patterns on npm. When I was investigating the module loading patterns of high-impact npm packages, I saw there are many packages out there using patterns that are not documented in the previous package.md. In fact the practices recommended by the previous documentation were considered less preferable in some cases. See Recommend node/default conditions instead of require/import as a solution to the dual package hazard node#52174 which recommends node/default over import/require. We should look into documenting what the community actually does, and if necessary, document discussions about their pros and cons.
  3. Discuss the recommended way to ship packages for various kinds of support goals. In particular, for these scenario
    • A package that has been authored in TypeScript/ESM, and has been shipping dual or faux ESM, and wish to ship native ESM for newer versions of Node.js
    • A package that has been authored in CJS, and wish to transition to ESM while maintaining CJS support for older Node.js releases while require(esm) is still experimental.
    • ..more scenarios to come, we should open separate issues to track these, but we'll get more productive after 1 is done.
  4. Reaching out to existing high-impact packages that intend to ship native ESM to validate what we document
  5. Work with community content creators to spread the word about the recommended patterns and migration practices. Maybe also reach out to some high-impact tutorials/documentations out there to update too, to prevent future users from picking up the obsolete practices from the top search results.
@joyeecheung
Copy link
Member Author

cc @nodejs/tsc @nodejs/loaders for visibility

@joyeecheung
Copy link
Member Author

Planning to discuss it at the collaboration summit session openjs-foundation/summit#422

@mhdawson
Copy link
Member

mhdawson commented Nov 2, 2024

There has been some related discussion in the @nodejs/package-maintenance team so at mentioning team as an FYI

@charlieforward9
Copy link

Hello, I attended the early morning session remotely, and I’m currently working on maintaining the react-leaflet-markercluster repository, which was archived for the past two years. One of my initial tasks was to implement ESM support to ensure compatibility with vitest. While I’ve made these adjustments, I’m uncertain if the changes maintain CJS compatibility.

I’m currently reviewing resources on ESM/CJS configuration for Node.js, including this article, to solidify my understanding. Given the small scope of this repository and the few files changed, I’d appreciate a review to confirm my approach. I’m also happy to offer this repo as an example for the broader initiative on shipping patterns.

Here is the PR: yuzhva/react-leaflet-markercluster#214

Thank you!

@joyeecheung
Copy link
Member Author

joyeecheung commented Nov 9, 2024

@charlieforward9 I am not an expert on react but since the PR is using require + import conditions, you might want to give nodejs/node#52174 a read - if the package would be fine to have two instance of itself in the same context and relies on no global state, then it's probably okay. Otherwise it may run into the dual package hazard:

  1. Some end user ESM code -> import CJS intermediate dependency -> require CJS version of your package
  2. Some end user ESM code -> import ESM intermediate dependency -> import ESM version of your package

now a duplicate pair of the CJS and the ESM version of your package are loaded and initialized in the same context, which may or may not be okay.

@joyeecheung
Copy link
Member Author

Notes from the collaboration summit session: https://hackmd.io/V3xtjlcrTIGsemPv8t-tKg

@joyeecheung
Copy link
Member Author

Opened #3 for point 1: starting a team

@joyeecheung
Copy link
Member Author

Removing agenda labels. Team discussions moved to #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants