Giter Site home page Giter Site logo

Comments (7)

SquareMesh avatar SquareMesh commented on May 10, 2024 1

Thanks for the quick update :)

I'm just getting started in the deno / javascript / typescript arena. But in looking to be helpful I came across a reference to dynamic loading of modules. Maybe helpful to you. No rush happy for progress to happen as it does.

https://stackoverflow.com/questions/13444064/typescript-conditional-module-import-export

async function importModule(moduleName):Promise<any>{
    console.log("importing ", moduleName);
    const importedModule = await import(moduleName);
    console.log("\timported ...");
    return importedModule;
}

let moduleName:string = "module-a";
importModule(moduleName)
.then(importedModule => {
    console.log("importedModule");
});

edit: formatting

from denodb.

eveningkid avatar eveningkid commented on May 10, 2024 1

Exactly, this is what I have done actually and it works fine. I explained the issue better on their repo: they have an await init(...) statement which needs to be "done" before using the library. However, when using await import(...) it does not wait on it, and raises an error!

I don't think it is good practice to have an await statement in your main file. It should be an additional function that initialises the library, but for now that's all we have.

This is why I said we can only wait or make a fork which isn't ideal at the moment :D

from denodb.

eveningkid avatar eveningkid commented on May 10, 2024

Hey,

Thanks a lot for raising this question, you're right about this.

So basically, after introducing Mongo in denodb, it turned out that we would always need to add --unstable and others.

I will have a look at it and see if this could only be called when using Mongo and still keeping the codebase consistant.

I will get back to you very soon!

Keep in touch

from denodb.

SquareMesh avatar SquareMesh commented on May 10, 2024

No worries, thanks for the update.

from denodb.

eveningkid avatar eveningkid commented on May 10, 2024

Alright so a quick update: I rearranged the code for this to be working the way you would expect, e.g. we now only need deno run --allow-net --allow-read ... to use mysql.

The problem is: deno_mongo cannot be lazy-loaded correctly, which creates all sorts of problem at the moment (I just asked them if they could do something about it).

So until they get back to me, we will have to wait. I found a solution, could just make a fork and use that fork instead of their github but this is just not a good solution right now.

Unless they can't figure something out, we will do it "the dirty way" then.

Just be patient then, I will update this issue whenever I hear back from them :)

from denodb.

eveningkid avatar eveningkid commented on May 10, 2024

Alright, #57 should have fixed it!

I decided to go with the fork option as it doesn't seem to be changing on the other repo.

You should just use deno run --reload ... to make sure you get the updated version!

Reopen the issue if it's not working but I guess it should :)

Take care

from denodb.

SquareMesh avatar SquareMesh commented on May 10, 2024

Hi @eveningkid

Thanks for your work on this, it worked a treat. The whole downloading a DLL and --unstable options didn't sit well against the appeal of security within Deno.

from denodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.