Ross Gerbasi
01/14/2022, 9:35 PMnode-fetch
in my project so I installed it like normal npm i node-fetch
. This gave me v3 which is type: module
only. This should be fine as I am using a TS project and it shouldn't matter much. However I kept getting an error with SST telemetry as it also uses node-fetch
node_modules/@serverless-stack/core/dist/telemetry/post-payload.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module"
```
I disabled telemetry in my SST project but sadly this file still seems to load and cause the error. So for now the only option is to stick with for node-fetch@2.
Anyway hope this helps someone.thdxr
01/14/2022, 9:49 PMthdxr
01/14/2022, 9:50 PMhttps
module? Think our situation is simple enoughRoss Gerbasi
01/14/2022, 9:50 PMFrank
yarn.lock
file, it seems there are a couple other packages that depends on node-fetch
. Will removing node-fetch
in telemetry fix the issue?thdxr
01/14/2022, 10:39 PMFrank
Cptflammin
01/17/2022, 11:15 AMthdxr
01/19/2022, 7:55 PM