Question:
I have defined a javascript class, with a static variable, which causes a warning build.log report on publication.
Product:
Old editor or Studio, happens in either.
What are you trying to achieve:
define a class static variable accessible to to class referring code.
What have you already tried:
Here is an example:
class Test {
static VAR = "abc";
static GetVAR() {
return Test.VAR;
}
}
export function VarTest() {
console.log( "Var static: " + Test.VAR );
console.log( "Var internal: " + Test.GetVAR() );
}
This code works, if run, it behaves as expected and outputs the variable.
But there is a warning when publishing in the build.log on the definition line.
Additional information:
Here is what the editor shows, with a warning:
And, the build error on publishing the site:
And, the build log error:
Yet, on execution, calling the function, it works as expected: