Hi everyone, I actually found a solution for my problem, and maybe you guys are coming across the same problem.
I got rid of this error and I was able to build successfully my project:
Parsing error: Invalid right-hand side in an assignment expression
The problem I found is in 3 files (The image attached has the fixes already):
Basically, you will have to remove the function interopRequireDefault() from imports in three files:
node_modules/moralis/lib/browser/encode.js
node_modules/moralis/lib/browser/decode.js
- ParseFile
- ParseGeoPoint
- ParsePolygon
- ParseObject
- ParseACL
- ParseOp
- ParseRelation
and in the file node_modules/moralis/lib/browser/Cloud.js
- ./decode
- _encode
- ParseError
- ParseQuery
Unfortunately, this is inside the moralis package so maybe someone will see this post and will improve it, the Parse files are actually coming with a default object duplicated because of this function, and maybe the way vite is building the project. (I’m not sure)
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
}
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
as the example below:
{
default: {
_esModule: true,
default: {}
}
}
Hopefully, it can be helpful for anyone around here who was struggling to build the react project with Vite because of Moralis SDK.