Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@uppy/companion: fix esm imports in production/transpiled builds (#4561)
TypeScript is used to transpile companion to CommonJS. `require()` in CommonJS is synchronous and cannot be used to import packages using ESM syntax, which are asynchronous by spec. If you want to import an ESM package, you need to use asynchronous dynamic `import()`. By default TypeScript transpiles this to `Promise.resolve().then(() => require('webdav'))` which is obviously using synchronous `require` internally and breaks the import of ESM packages. We need to switch `moduleResolution` to `node16` to make TypeScript not transpile the `import()` call.
- Loading branch information