When I set the purpose of script.js to "Import for Events" and run the code I still get errors:
5bootPreview.js:55 Unexpected message type 'undefined'
OnBootMessage bootPreview.js:55
bootPreview.js:92 Registered service worker on preview.construct.net
4bootPreview.js:55 Unexpected message type 'undefined'
OnBootMessage bootPreview.js:55
previewWindow.js:28 [C3 preview] Browser opened wrong size popup: wanted 854 x 480, got 854 x 415; resizing to compensate
main.js:4 Uncaught SyntaxError: The requested module './script.js' does not provide an export named 'default'
I have no idea why I need an export named 'default'. Is this in the manual somewhere?
Can you please supply an example of a project which uses an external script file with a function to add 2 numbers which can be called by an event? As well as a variable that can be accessed globally?
Sometimes the simplest things are hard to know how to achieve to the novice who isn't familiar with all the rules around how things actually run and are executed.