Cannot access ‘functionName’ before initialization

If you havent disabled Flytrap’s default function hoisting behavior in the Flytrap config, this error shouldn’t happen. If it does, open an issue.

If you have disabled Flytrap’s default hoisting behavior, then the above error can happen.

Solution

You can either enable Flytrap’s hoisting behavior, or move all invocations of function declarations (eg. function foo()) to be used after the functions are declared.

For example:

console.log(foo());
function foo() {}

Should be rewritten as:

function foo() {}
console.log(foo());