D
Deno

help

Unexpected token 'export' (deno_core)

Bbaphomet_the_traveller3/31/2023
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?
ABTAndreu Botella (they/them)3/31/2023
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
Bbaphomet_the_traveller3/31/2023
Is there a non asynchronous version of load_main_module?
ABTAndreu Botella (they/them)3/31/2023
no since modules can have top-level await
Bbaphomet_the_traveller3/31/2023
Ok last question... Switched to using global.functionName instead of modules, but the global keyword doesn't work either. globalThis does work, strangely
ABTAndreu Botella (they/them)3/31/2023
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
Bbaphomet_the_traveller3/31/2023
Right Fair enough. Thanks!

Looking for more? Join the community!

Recommended Posts
global is not definedWhy Deno doesn't have global like node.js? There is globalThis, but some things from npm packages arUsing querySelector on NodeI am doing something like: ```ts const nodeList: NodeList = document.querySelectorAll(".foo"); constSimpler way to read a file relative to current module?So I wrote a little helper function for reading the text content of a file relative to the current merror: BadResource: Bad resource IDI'm writing tests for https://github.com/deno-libs/tinyhttp/pull/9. ```js import { describe, expectRecent deployment not working?Hi there I have an api that was working just fine not sure what happen but new deployments are not wHow do you get the path to a file relative to the module which is referencing it?```ts const GET_PROGRAM_QUERY = Deno.readFileSync("./GetProgram.gql"); ``` GetProgram.gql is a fileInvestigating memory leak after adding new app dependencyHi, I added an OpenTelemetry metrics reporting loop to a Deno program and found that Deno began leakVScode deno lint blew up again after update.It seems every time there's an extension update VScode lint blows up and will stop recognizing top limport cache not workingI can't install cache of my http imports:Why isn't this error caught?Basic code example: ``` try { Deno.remove("fakefile"); } catch (err) { console.log("File doesn'tUsing dynamic import with npm compatibility gives intermittent error "__DENO_NODE_GLOBAL_THIS_167935This is pretty hard to google because the number at the end of the error changes everytime it happenGraphql codegendoes anyone have a solution to generate the sdk using graphq-request with Deno?Deno Third Party Modules Web HooksIs there a way to see the webhook payload URL a package you have published is listening for?Does Deno Deploy support location based analytics?The free version does not seem to support it. Does the paid version support it?IPC solution for a process manager👋 I'm at day 7 of working on Pup (https://github.com/hexagon/pup) - a universal process manager rSpecifying config remotely or jsx on installI'm struggling quite a lot here. I originally recommended using this command: ```bash deno install -Is it possible to know what version of a dynamically-imported module was just imported?Right now, you can run code like `import('npm:lodash')`, which will get the latest version of lodashWhy am I getting an "Uncaught DOM Exception" in the Deno CLI?To replicate: 1. `deno` in the command line to initialize a Deno REPL ``` // Get an array of random Better way to allow downloading of files besides serving entire fileI'm trying to allow users to download files that are in a private folder which cannot be accessed puShare state between islandsHi. How could I share state between island. E.g. shopping cart. I click on add product and in some o