Error when creating new instance of new Parse.Query: "Right-hand side of 'instanceof' is not callable"

I’m getting the following error whenever I create a new instance with new Parse.Query(Icons);:

Uncaught (in promise) TypeError: Right-hand side of 'instanceof' is not callable
    at new re (vendor.896abb9e.js:12:10288)

The weird thing is that the error only happens when I run the project in produtction, when running in dev it works as expected. I’m using Vue and Vite if it’s of any use. I’ve searched everywhere but I could not find any similar errors, would anyone know why this is happening?

Many thanks in advanced, it’s driving me crazy.

Could you share how you are initializing Icons var and also the complete error stack?

Sure, here is the full error stack:

And this is the code that works just fine when in dev (npm run dev / vite), but not when in prod (npm run build / vite build), which is running inside a function called getIconsArray() you can see on the error above. It seems the error happens when creating a new instance of Parse.Query(...)

Many thanks and let me know if there’s anything else you’d like.

It looks an error when building the files. Can you check on this .js file what do you have on that line throwing the error?

That would make sense, I think the error started happening when I switched to using Vite, it was working fine when I was using Webpack. Although I have no clue how I could fix this, I’ll also do some reserach around this.

And what file do you mean? The vecndor.js file on the error stack? That’s a compiled JS, but I can share that if you want.

Ok, so I seem to have found the solution, importing Parse as
import Parse from 'parse/dist/parse.min.js' instead of import Parse from 'parse'.

For some reason the latter worked in the dev build under Vite and with Webpack in all circumstances, but not when running the production build with Vite.

Not sure if it’s a bug or intended behaviour, but it works now. Thanks!


I don’t use Parse at all, but in my Vite-React app one of my dependencies was giving me the same issue in the production bundle. Nasty one!
But your solution helped me solve it, thank you.