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
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
boopus_the_snootus
Is there a non asynchronous version of load_main_module?
Andreu Botella
no since modules can have top-level await
boopus_the_snootus
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
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
boopus_the_snootus
Right Fair enough. Thanks!

Did you find this page helpful?