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

Hello community,

first post here! I’m experiencing the exact same error from this post .

I have created a minimale repro on Codesandbox .

You will notice that the OP from the other post and I are both using Vite, which I believe is what is ultimately causing the issue.

The error happens here in LiveQuerySubscription.js:

var Subscription = /*#__PURE__*/function (_EventEmitter) {
  (0, _inherits2.default)(Subscription, _EventEmitter); // error happens here

  var _super = _createSuper(Subscription);

and it’s apparently because the following check fails in babel/runtime-corejs3/helpers/inherits.js:

function _inherits(subClass, superClass) {
// superClass is === undefined and the error is thrown
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");

  subClass.prototype = _Object$create(superClass && superClass.prototype, {
    constructor: {
      value: subClass,
      writable: true,
      configurable: true
  if (superClass) setPrototypeOf(subClass, superClass);

…since superClass is undefined and the strict check !== null fails


All this is probably because Vite uses no preprocessor and instead leans on modern browsers being able to use ES6 modules? I don’t know, may be something completely different. All I know is that I don’t have this issue using the vue-cli in place of Vite… but then again, I was just migrating to Vite!! :cry:

Hope this can be solved, thanks in advance,



I got a similar error after cloning the project onto another computer. What worked was to delete package-lock.json and npm install again, and commit the new package-lock.json into my repo. Somehow it seems the Babel version was stuck and somehow it works on one computer but not another.

Found a way to make it work by using the minified version of Parse (answer from TypeError when bundling latest Parse JS SDK using VITE (the vue bundler) · Issue #1362 · parse-community/Parse-SDK-JS · GitHub)

1 Like