Currently have a serverless application. When I run tests with the mocha plugin everything is fine. The second I move everything up, things are starting to break.
I am using module.exports to export the following function:
const processTime = (reportSchedule, isNew) => {
const { Type } = reportSchedule;
switch (Type.toLowerCase()) {
case “weekly”:
return findNextRunDateWeekly(reportSchedule, isNew);
case “monthly”:
return findNextRunDateMonthly(reportSchedule, isNew);
default:
return null;
}
};
module.exports = {
processTime
};
And using it as so:
const { processTime } = require("…/util/report.scheduling.util");
However, when I hit my API I am getting the following error:
Cannot assign to read only property ‘exports’ of object ‘#’
I have looked other places and they suggest that i am mixing “export default” and “module.exports” and I am not. Any thoughts? Could this be something with my serverless-bundle plugin?