Coder Social home page Coder Social logo

Comments (2)

darkbasic avatar darkbasic commented on June 10, 2024 1

I closed the issue because I decided that it wasn't going to achieve anything at the end of the day and I didn't want to be controversial for no reason, but since you've answered I'll tell you my view.

I guess you don't provide cjs because of dual package hazard concerns. While that is true you also suggest to use async imports in a library which is going to output commonjs code. Even if we don't consider the fact that this is only viable in async contexts, that same hazard exists for esm-only packages that get imported in commonjs projects via async imports so your suggestion goes against the reason why you decided to bundle pure esm in the first place and my library could bite other users because of that!
Also in my case the whole graphql ecosystem bundles dual packages and thus using instanceof is already a big hazard (let's not talk about yarn link which creates a similar issue).
The developer experience for esm modules on Typescript is still suboptimal because importing commonjs modules with default exports is a mess and the js extension in the imports is counterintuitive to say the least.
I personally think that it's still too early to target pure esm in a library but at the same time you cannot ignore deno/bun existence so dual package is the lesser evil. Just my two cents.

from node-fetch.

jimmywarting avatar jimmywarting commented on June 10, 2024

You can use async import to load esm modules in cjs
#1279

from node-fetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.