I experiencing a problem below. All I know, it's because I added the "type": "module" in my package.json file. But do we have a way to convert the following code in module? I cannot find good resources so far.
const model = require(path.join(__dirname, file))( ReferenceError: require is not defined
My code:
const model = require(path.join(__dirname, file))(
sequelize,
Sequelize.DataTypes
);
db[model.name] = model;