Code:
const express = require('express');
const app = express();
const cors = require('cors');
const mongoose = require('mongoose');
const multer = require('multer');
const inMemoryStorage = multer.memoryStorage();
const uploadStrategy = multer({ storage: inMemoryStorage }).single('image');
const { BlockBlobClient } = require('@azure/storage-blob');
const getStream = require('into-stream');
I can't use require in importing 'into-stream' module, it gives me ESM error:
Error [ERR_REQUIRE_ESM]: require() of ES Module
I tried adding type:module in package.json however require will not work if I do that. Do I install another version of into-stream? or should I use import rather than require. I am using node.js.