jaredpalmer / jaredpalmer/backpack

Class constructor cannot be invoked without 'new' when extending a class

Open
#79 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.4k
Forks
164
PR merge metrics
No merged PRs in 30d

Description

Hi, I am getting the error "Class constructor cannot be invoked without 'new' " when trying to create a new instance of a class that extends another one.
```
class Parent {}
class Child extends Parent {
constructor(){
super()
}
}
new Child()
```
The error will occur on the line `constructor(){` .
Any ideas on what is causing the error? I think it's due to Babel compiling to the wrong version.

Contributor guide

Open the contributing guide

Research direction

The report names no source file, test, or entry point; start by reproducing the class-extension example in Backpack's build environment and inspect its Babel and webpack configuration. Done means identifying whether transpilation causes the error and recording a verified fix or configuration change, with a regression test if an existing test area is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.