sindresorhus / p-queue

Promise queue with concurrency control
MIT License
3.45k stars 185 forks source link

'p-timeout' is expected to be of type CommonJS - Why Am I Getting This Error? v7.0.0 #137

Closed AugustoZanoni closed 3 years ago

AugustoZanoni commented 3 years ago
import pTimeout, { TimeoutError } from 'p-timeout';
                   ^^^^^^^^^^^^
SyntaxError: The requested module 'p-timeout' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'p-timeout';
const { TimeoutError } = pkg;

I'm using it in a router file, NodeJS