Closed trey-trimble-posh closed 9 months ago
Yes, we're aware and it's on our V4 backlog here: https://github.com/orgs/pnp/projects/1/views/1
For this item we've explored including both commonjs and esm in the module package, but it caused more problems than it solved. The situation you describe is really a result of how the node commonjs, typescript, and esm module resolution story is all a bit of a mess vs an issue with this library. As the fix is simply to include the file extension its a case where trying to solve it is worse than the initial problem. For v4 we will continue with publishing esm modules. But we did do a significant investigation, so don't want you to think we didn't look into things. Thanks!
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
Target environment
NodeJS
Additional environment details
Using Node 16 with typescript. Node type is commonjs with tsconfig
Enhancement Idea
We are currently running a commonjs node application. Using node16 we can use @pnp/sp with the following tsconfig options:
However because of Node 16's restriction for moduleResolution on require file extension on relative imports the type augmentation fails for the following. I'm using all of this in a .mts file. Can't tell if this will become supported at some point either.
This leads to a bunch of ugly @ts-expect-error messages. Simple fix is to supply a file extension in the module files. from
to