uniforms: meteor 1.7.0.1 - TypeError: Class constructor _class cannot be invoked without 'new'

this line fails in meteor 1.7.0.1:

import AutoFormBase from 'uniforms/AutoForm';

const Auto = parent => class extends AutoFormBase.Auto(parent) {
  static Auto = Auto;
};

any idea?

full error:

modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:98346 Uncaught (in promise) TypeError: Class constructor _class cannot be invoked without 'new'
    at new _class (modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:98346)
    at new _class (AutoForm.js:9)
    at modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:80870
    at measureLifeCyclePerf (modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:80651)
    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:80869)
    at ReactCompositeComponentWrapper._constructComponent (modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:80860)
    at ReactCompositeComponentWrapper.mountComponent (modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:80763)
    at Object.mountComponent (modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:73688)
    at ReactCompositeComponentWrapper.performInitialMount (modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:80946)
    at ReactCompositeComponentWrapper.mountComponent (modules.js?hash=441a59febac0d39753b5eebcca0bbdcb08b83a80:80833)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 37 (34 by maintainers)

Commits related to this issue

Most upvoted comments

Just ran into this again, since it doesn’t seem like a reproduction was ever extracted, here is one: https://github.com/Floriferous/meteor-cypress-debug/tree/bug/class-constructor

EDIT: Workaround for me at the moment is to change this:

// Failing
import AutoForm from "uniforms-material/AutoForm";
import AutoField from "uniforms-material/AutoField";

// Working
import { AutoForm, AutoField } from "uniforms-material";

@radekmie cool! thx! looks similar to what i did in another project https://github.com/react-page/react-page/pull/699/files

@mariusrak @radekmie

I explained above what causes the issue (see https://github.com/vazco/uniforms/issues/433#issuecomment-406887427)

The only workaround possible at the moment is the symlinking described above https://github.com/vazco/uniforms/issues/433#issuecomment-406889261

@radekmie, yes simlinking src into the app seems to work!

I’ll reopen it then.

I had no success yet.

In your .babelrc you have

[
    "@babel/preset-env",
    {
      "useBuiltIns": "usage"
    }
  ],

i am not sure if this messes with meteor 1.7’s legacy and modern browser support?

maybe @benjamn can shed some light on that

Haven’t tried it yet. I’ll give it a shot later this week.