[v5] node-fetch in ace command #3560
-
Hello community I am trying to create a new ace command and I am having some issues with a import. I know that in commands the top imports are not supported, but I still want to import a package into my command. const { default: fetch } = await import('node-fetch') but it does not work
Any suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, So downgrade to node-fetch@2 and it should be fine. |
Beta Was this translation helpful? Give feedback.
Hello,
the latest versions of node-fetch are ESM-only, as specified in the README:
https://github.com/node-fetch/node-fetch#commonjs
So downgrade to node-fetch@2 and it should be fine.
Btw, you can totally have an import for node-fetch on top level. Only IoC dependent imports are not possible on top-level.