Git Product home page Git Product logo

Comments (5)

sindresorhus avatar sindresorhus commented on May 18, 2024 1

Does TypeScript have a compile target of esm?

Yes

If so, you could add a “module”: ‘dist/esm.js” or something and that would make this work transparently with esm users (who opt to bite the mjs bullet)

Not interested in compiling to multiple targets. I don't even think that's possible with TypeScript. I plan to switch everything over to ESM when it's out in Node.js without a flag. Until then, it's CJS. It's up to you to handle that.

In this case, it's seem more like a bug in the esm package though.

from p-queue.

jdhiro avatar jdhiro commented on May 18, 2024

As a workaround, this did the trick for me:

import pq from 'p-queue'
const PQueue = pq.default

However, I'm still a tad confused why this works and import { default as PQueue } from 'p-queue' does not.

from p-queue.

clibu avatar clibu commented on May 18, 2024

+1
import PQueue from 'p-queue' works in the Browser using parcel.js to build. But it does not work in Node.js
@jdhiro solution does work in Note, but is messy.

from p-queue.

smashah avatar smashah commented on May 18, 2024

import PQueue from 'p-queue' works in ts-node

from p-queue.

ecolss avatar ecolss commented on May 18, 2024

+1
import PQueue from 'p-queue' works in the Browser using parcel.js to build. But it does not work in Node.js
@jdhiro solution does work in Note, but is messy.

Same issue with Node, did you find a solution?

from p-queue.

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.