Closed omar-dulaimi closed 3 years ago
@sindresorhus Well I have already checked that, and already using import syntax and tried a dynamic import but nothing worked.
I had to revert back to v4 until this issue is fixed.
So, how can we fix this? I'm using it with NestJS, changing package.json and tsconfig.json will break other things. Can't we support require
for compatibility? Like for example import pMap from 'p-map/legacy'
?
Well, I ended up reimplementing p-map in a util function...
export const pMap = <T>(array: any[], func: (...args: any[]) => Promise<T>): Promise<T[]> => Promise.all(array.map(func));
It's a bit annoying when you can't use the most current version of a nice module in your project
Ah, all modules from this author seem to have ESM now. This is annoying for anyone using Babel or Typescript or someone sticking with CommonJS. You should just keep this lib at CommonJS to be honest - since that can be importd from ESM aswell. Sad
const pMap = (...args)=>import('p-map').then(({default: pMap})=>pMap(...args));
Hello,
How to use this library with typescript? I'm getting this error:
Here's my tsconfig: