I am trying to call a function from an imported class in my index.js using WebPack like this:
import TetrisController from './js/Controller/tetrisController';
let tetris = new TetrisController();
tetris.runTetris();
TetrisController:
export class TetrisController {
constructor() {
...
}
setuctxList() {
let list = [];
for (let i = 0; i < ucanvasList.length; i++) {
uctxTemp = ucanvasList[i].getContext('2d');
list.push(uctxTemp);
}
return list;
}
runTetris() {
uctxList = setuctxList();
addEvents(); // attach keydown and resize events
function frame() {
drawNext();
requestAnimationFrame(frame);
}
reset();
drawBottom();
resize();
frame();
}
}
export default TetrisController;
The problem is that it returns a Uncaught ReferenceError which says the function setuctxList() is not defined.
The console error: main.js:2 Uncaught ReferenceError: setuctxList is not defined at Object.runTetris (main.js:2:71774)
I think it has something to do with WebPack but I do not know for sure. What is going wrong here?