#Unexpected token 'export' (deno_core)

13 messages · Page 1 of 1 (latest)

unique hare
#

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?

lucid nacelle
#

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

unique hare
#

Is there a non asynchronous version of load_main_module?

lucid nacelle
#

no

#

since modules can have top-level await

unique hare
#

Ok last question... Switched to using global.functionName instead of modules, but the global keyword doesn't work either.

#

globalThis does work, strangely

lucid nacelle
#

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