I have an app.js and another Highlight.js file.
In Highlight.js I have the following code:
export default class Highlights {
function foo() { alert(1) };
}
and in app.js I try to call the function foo as follows:
import highlight from './custom/HighlightingObjects.js';
highlight.foo();
But already at compling this via webpack I get an error message, that there is an unexpected token at:
function foo() { alert(1) };
How can I handle this?
foo, when fixed, will be a method, so you can't call it like that, you should instantiate the class first like so:let instance = new Highlights();then usefoolike so:instance.foo();'./custom/HighlightingObjects.js', please verify the path is correct