D
Deno

help

Force await import() to import a fresh copy?

SSembiance9/27/2023
I have a Deno instance that dynamically loads a module with: await import("some/module.js") The module changes on disk and now I want the running deno instance to import it again getting the fresh changes. I was accomplishing this by adding a random number like await import("some/module.js?v=" + Date.now().toString()) which deno then views as a new file and happily loads it. Problem is, over time, this caused my deno dep_analysis_cache files on disk to become HUGE (1GB+). Is there a magic way I can force deno when I call import() to always import a fresh copy? Or some whay to clear the already loaded cached content? Or should I just stay on top of the dep_analysis_Cache bloat and delete them when they get big?
Nnayeemrmn9/27/2023
If you use # instead of ? our system should know to share underlying resources like this, since it should know it's the same file. I don't know if dep_analysis_cache does that though. cc @dsherret
SSembiance9/27/2023
Cool, using # instead of ? does indeed work, thanks. Hopefully the cache file won't baloon over time 🙂
Nnayeemrmn9/27/2023
Yeah that was the part I wasn't sure about...
SSembiance9/27/2023
Also, the balooning was seen in deno many versions ago, not sure if it still happens in more recent deno versions or not. I'll keep an eye on it and see how it does (currently running deno 1.35.0)
Ddsherret9/27/2023
the dep analysis cache only gets cleared out with each deno upgrade. Makes sense it would keep growing if doing something like this
SSembiance9/27/2023
k. I'll just clear it out monthly if it gets too big, with my regular system maintenance I perform. Thanks 🙂
Ddsherret9/27/2023
There's a new deno released every week and new minor every month so it might be easier to just upgrade deno monthly

Looking for more? Join the community!

Recommended Posts
Fresh ClassList Brokenhttps://github.com/Leave TLS connection open in between testsWhen I have 2 tests that use a database connection and attempt to close the connection `afterAll` thNvim tsserver clash with denolsI have read the docs and added a root_dir in my lua lsp file but for some reason tsserver still lanccircular type reference nonsensewhy does removing an array nest cause this to be a circular dependency?? shouldn't it be functionallGetting exports from an evaluated module with get_module_namespace always results in null valuesTrying to get module exports like the example [here](https://github.com/denoland/deno/pull/14026/fiIs there any way to define a signal inside a route component?Is there any way to define a signal inside a route component? I am trying to do it but an error raiDeno EmitHow come does `deno bundle` work a lot differently to Deno emit (https://deno.land/x/emit@0.28.0 )? `deno lsp` does not understand bare imports without prefixEven in minimal project, freshly created from a template, Deno marks imports as errors and doesn't uWhen I use crypto in this code, it returns 'Unknown cipher.'const secret ="**1111111111111111111**"; let encryptedText='test'; const decipher = crypto.cTroubleshooting deno.land downloadsI have docker containers, within a minikube cluster, that have trouble downloading https://deno.landRun remote Fresh application code locally.Is it possible to run a remotely hosted Fresh application? E.g. I'm attempting to do `deno run -A hmigrate from node to deno: p5js projectHi, I want to rewrite my p5js project built with nodejs in deno. Here is my code: https://github.coPeer dependencyCan I somehow mark a dependency as "peer"? So this dependency (which is known to shuffle typings bet'Spawn' multiple promises from the same moduleI'm trying to use Deno for scripted npcs in a game, the main issue that the npc has to await user acReturn results from execute_main_moduleI currently have this function to run some execute some js ``` pub async fn run(&self, path_to_Fresh Blog + Website Thingshttps://vuepress-theme-yuu.netlify.app/, what is the closest thing to that which can be run on Fresh