Giter Site home page Giter Site logo

Comments (4)

muralikr avatar muralikr commented on May 9, 2024

I have investigated this issue with our application. I found why this issue surfaces only in production mode.

In Mendel V1, we were able to catch these issues in dev mode. Since we have daemon in Mendel V2 (to boost developer productivity). Now, daemon caches all modules so resolving dependencies is always smooth.

It is hard to resolve cyclic dependencies in runtime (same with other libraries), we should show a warning to developers for such cases. This will help in catching these issues very early.

from mendel.

irae avatar irae commented on May 9, 2024

I think this can be implement in the client, specially because this is on a per bundle request. I think deamon is correct so far. Deamon job is to get a bunch of source files and do all the transforms, watching file system, etc. If the dependency is circular or not depends on bundle resolution.

I am curious tho that in development the issue does not exist. Were you able to diagnose why development works well?

from mendel.

muralikr avatar muralikr commented on May 9, 2024

In production during server side rendering, mendel tries to resolve all dependencies. In mendel-loader/resolver.js file, we store incomplete module in cache. If other files request for this module before mendel internal cache gets updated, they get only incomplete module.

This doesn't happen in development mode, since daemon stores all complete modules in its cache. I am yet to fully investigate why dev works fine, please let me know if my hypothesis is wrong.

from mendel.

irae avatar irae commented on May 9, 2024

I think it makes sense.

But on the other hand, I remember @gomezd implementing this, and there was a notion of testing to see if the request is ready. Since the middleware is async, it is possible to wait for it to be ready.

This way, during SSR, you can hold until the resolver is ready and call the code only once incomplete module is done.

We might need to expose to the middleware some sort of listener. I don't know how development middleware deals with it exactly, but I think it waits for the sync event from the daemon.

from mendel.

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.