Has anyone got non-ESM packages working with ESM-i...
# typescript
l
Has anyone got non-ESM packages working with ESM-ified Pulumi? My tests all work fine, but anything that has a
import { default as X } from "Y";
fails when running via Pulumi. For example:
Copy code
error TS2305: Module '"../../node_modules/@types/adm-zip"' has no exported member 'default'.
I'm using the same tsconfig.json for both tests and Pulumi.
My tests package.json has:
Copy code
"target": "es2020",
    "type": "module",
The module that's importing the non-ESM package has this in its package.json:
Copy code
"type": "module",
    "module": "esnext",
    "target": "es2020",
And my Pulumi project's package.json has this:
Copy code
"target": "es2020",
And all three packages are workspaces in a Yarn4 project. The root package.json has this:
Copy code
"module": "esnext",
  "target": "es2020",
I've been playing with hoisting, getting different error messages. It is possible to eliminate this error by having the relevant dependencies in the correct workspace's node_modules folder, instead of (or as well as) having it hoisted to the root.
Unfortunately I don't really understand the new installConfig.hoistingLimits setting, and I don't know how to get a full node_modules into one workspace, while leaving all the others using hoisted dependencies as much as possible.