Unexpected token 'export' (deno_core)

Playing around with ModuleLoaders, but doesn't seem to make a difference Scripts containing the export keyword don't load due to above error How can I allow the keyword?
6 Replies
Andreu Botella (they/them)
execute_script only parses/runs scripts, not modules much like <script> in HTML, rather than <script type="module"> you have to use load_main_module and evaluate_mod and so on together with a module loader
baphomet_the_traveller
Is there a non asynchronous version of load_main_module?
Andreu Botella (they/them)
no since modules can have top-level await
baphomet_the_traveller
Ok last question... Switched to using global.functionName instead of modules, but the global keyword doesn't work either. globalThis does work, strangely
Andreu Botella (they/them)
global is just part of the Node.js API, it's not a JS built-in deno_core doesn't have window either you can add it by executing the script globalThis.global = globalThis; or by having that as part of an extension
baphomet_the_traveller
Right Fair enough. Thanks!