According to [v14-migration-guide]
(https://vaadin.com/docs/v14/flow/v14-migration/v14-migration-guide.html) I should move script.js to <PROJDIR>/frontend and I still use @JavaScript("frontend://script.js"). Doing that the file can then be found but when I try to run it with spring-boot:run then in the browser it I get (ReferenceError) : greet is not defined. Should this work or does it need to move to a different place?
It appears that script.js is not being copied to target/frontend. This works in Vaadin 13 but with script.js being in webapp/frontend.
Hi Ross,
As mentioned in the v14 migration guide, “you should not use a frontend protocol (frontend://) in the path of your resources anymore, and add the ./ prefix to the file path.” So, your annotation should be @JavaScript(“./script.js”).
Vaadin 14 loads your JavaScript as a JS Module, which means that it runs in strict mode. With strict mode, it’s an error to reference a variable that isn’t declared. Without strict mode, it’s treated as a global variable. When running in the browser, the top-level window object which represents the browser window (or tab) is used for storing global variables.