Giter VIP home page Giter VIP logo

Comments (11)

huan avatar huan commented on July 28, 2024 2

Really? I will have a look into it when I have time.

On the other hand, I remembered that the hotImport feature is working inside Docker container too.

from getting-started.

suntong avatar suntong commented on July 28, 2024 1

I think ... the await hotImport in async function onMessage that is causing the problem.

Moving the await hotImport out of the async onMessage event-handling function solved the problem, because the redefinition was indeed the problem.

from getting-started.

suntong avatar suntong commented on July 28, 2024

Made another attempt to fix it myself, still nok

from getting-started.

huan avatar huan commented on July 28, 2024

Hi, I did not use a constant in hotMod before, however, I had just checked the document and it seems should support it. (at https://github.com/zixia/hot-import )

Can you try to run the example at https://github.com/zixia/hot-import#full-example ? the source is at https://github.com/zixia/hot-import/blob/master/examples/demo-js.ts

I'll also have a look into your code(which use a constant in module like cfg.db.host) later.

from getting-started.

suntong avatar suntong commented on July 28, 2024

Yeah, the demo-js.ts works fine for me, I've tested it as

both work fine.

from getting-started.

suntong avatar suntong commented on July 28, 2024

I think the problem is not constant in hotMod, but the **await** hotImport in **async** function onMessage that is causing the problem.

Once again, It works for the first received message but not the second.

from getting-started.

huan avatar huan commented on July 28, 2024

Did you find any way to resolve this issue and could you share it for us? Thanks.

from getting-started.

huan avatar huan commented on July 28, 2024

Yes, we should only use hotImport once for a module from the beginning of the code.

Glad to hear from you that this issue had been fixed. Cheers and happy Christmas!

from getting-started.

suntong avatar suntong commented on July 28, 2024

Oh, actually it is not working -- It seems working because I have a let cfg = require('./config') at the top of the script, but I was not able to make it hotImported.

Reopening it, and hope someone can put hot-import config into the demo of https://github.com/wechaty/wechaty-getting-started/tree/master/examples/professional/hot-import-bot

It isn't hard for me if I know nodejs well.

thx

from getting-started.

mkliu avatar mkliu commented on July 28, 2024

The same problem happens to me too, if it's imported twice there's a problem. The error repros on docker

from getting-started.

mkliu avatar mkliu commented on July 28, 2024

I changed to this

if(!config)
{
  config = await hotImport('./config.js')
}

from getting-started.

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.