Vue + Vite + Parse JS: error “Super expression must either be null or a function”

I haven’t been able to find a better solution after hours of trying.

The Super expression issue comes from EventStream being undefined, which can be resolved with npm i events

This solves the issue for the dev vite server, but for the production build, another issue happens.

It seems that the JS SDK is compiled with babel/preset-env, babel-runtime, and browsify which creates {__esModule: true, default: ...} for each export. It seems that rollup on production then packages that up again, and decode2.default is not a function is thrown.

If anyone has any idea how to create a better solution than this solution, please let me know