I'm trying to import 'node-fetch'.
import fetch from "node-fetch";
But I seem to get an error.
C:\Users\pat\Documents\GitHub\js\flux\backend\dist\http.js:7
const node_fetch_1 = __importDefault(require("node-fetch"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\pat\Documents\GitHub\js\flux\backend\node_modules\node-fetch\src\index.js from C:\Users\pat\Documents\GitHub\js\flux\backend\dist\http.js not supported.
Instead change the require of index.js in C:\Users\pat\Documents\GitHub\js\flux\backend\dist\http.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\pat\Documents\GitHub\js\flux\backend\dist\http.js:7:38)
at Object.<anonymous> (C:\Users\pat\Documents\GitHub\js\flux\backend\dist\client.js:11:16)
at Object.<anonymous> (C:\Users\pat\Documents\GitHub\js\flux\backend\dist\index.js:6:34) {
code: 'ERR_REQUIRE_ESM'
}
My tsconfig can be found at https://sourceb.in/D5gqXavXF8