You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to write a class A that instantiate an object B that inherit from A?
I get the following error on runtime
a.js:3 Uncaught ReferenceError: Cannot access 'A' before initialization
at Module.default (a.js:3:56)
at eval (b.js:3:32)
at ./src/js/b.js (bundle.425598c….js:723:1)
at __webpack_require__ (bundle.425598c….js:1278:41)
at eval (a.js:5:63)
at ./src/js/a.js (bundle.425598c….js:712:1)
at __webpack_require__ (bundle.425598c….js:1278:41)
at eval (index.js:2:63)
at ./src/js/index.js (bundle.425598c….js:821:1)
at __webpack_require__ (bundle.425598c….js:1278:41)
If the current behavior is a bug, please provide the steps to reproduce.
I use 3 files:
index.js
import A from "./a.js";
let a = new A();
a.fct();
a.js
import B from "./b.js"
export default class A {
constructor() {
console.log ("a constructor")
}
fct() {
this.b = new B();
}
}
b.js
import A from "./a.js"
export default class B extends A {
constructor() {
console.log ("b constructor")
}
}
What is the expected behavior?
It shouldn't trigger an error at runtime. Since this is technically possible in JS as prooven on this JSFiddle
Anyway, you will have problems ReferenceError: Cannot access 'A' before initialization, if you will use this code, you can try it without webpack in browser and will see the same
Bug report
What is the current behavior?
I try to write a class
A
that instantiate an objectB
that inherit fromA
?I get the following error on runtime
If the current behavior is a bug, please provide the steps to reproduce.
I use 3 files:
index.js
a.js
b.js
What is the expected behavior?
It shouldn't trigger an error at runtime. Since this is technically possible in JS as prooven on this JSFiddle
Other relevant information:
webpack version: 5.82.0
Node.js version: 18.16.0
Operating System: Ubuntu 22.04
Additional tools: -
The text was updated successfully, but these errors were encountered: