GithubHelp home page GithubHelp logo

Comments (36)

alexisvincent avatar alexisvincent commented on May 27, 2024 1

Pushed and published to npm

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Thanks for the issue. I can't look at it just yet, I'm swamped with deadlines. But will check this out on the weekend.

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Can you be more specific? It would be really helpful to see an example dependency tree.

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

I will try to come up with a minimal example and ping you here!

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Any progress on this?

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

I am currently occupied with my studies but will post an example on Friday.

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Great :)

On Wed, 02 Nov 2016 at 23:26 Frederik Schubert [email protected]
wrote:

I am currently occupied with my studies but will post an example on Friday.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABz4rSRRBRm0DHvPfPP6lbiQp95BS14Bks5q6QAJgaJpZM4KYEDg
.

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

It is really difficult to come up with a minimal reproducible example for this issue. This error appears "sometimes" in our angular 2 projects. I suspect that the error is connected to how the decorators are evaluated.
One possible fix would be to reimport the modules in the order in which they were loaded the first time. As far as I understood from the code, the order of the reimports is decided by the order of Object.keys.
Sorry that I cannot come up with something more helpful yet.

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

I need to have a good look at how this hot reloader works. I think this codebase can be greatly simplified. But I may be wrong. I'm in the process of refractoring and adding comments. So I'll be in a better place to look at this later this week. SystemJS handles circular deps according to the spec. And when I take a look at this I'm hoping it's as simple as recursively deleting modules upwards and then reimporting the root and relying on SystemJS for the rest

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

Yes that would have been my approach as well. Currently the modules are deleted and reimported manually by the plugin.

The manual reimport is needed to call the reload hook of the deleted modules. See here

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Oh I see. Checkout issue #2. Won't need that reload logic anymore

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

Great!

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

See #2 I pushed a rewrite of the reloader, with new unload and state hydration mechanisms. Should fix your issue.

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

The rewrite looks good! I will give it a try as soon as I can and report my results here.

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Awesome, if you haven't already read the rewrite, I've added extensive documentation (as in more documentation then code I think), in the next.js file. Should be very clear how it works, I want it to be super simple to contribute.

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

Yes I read through it. It is much easier to comprehend now! 👍

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Cool cool 👍. The README has been updated to explain how this works.

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

I get the same error as #5. Using the version that is in master.
Seems like I was still using the old version.

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Oh, you need to import systemjs-hmr/dist/next.js

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

Alright. Now I get this error when the System.normalize hook is called during reload:

TypeError: this.has is not a function
    at SystemJSLoader.coreResolve (http://localhost:3000/jspm_packages/system.src.js:1730:12)
    at SystemJSLoader.<anonymous> (http://localhost:3000/jspm_packages/system.src.js:1752:32)
    at http://localhost:3000/jspm_packages/system.src.js:2546:36

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Hmm. How are you testing this?

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

I patched the systemjs-hot-reloader to use the new API. Basically I just removed the catch from here.
I also tried to do it via the console but I get the same error.

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

How far does it get in the reload process

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

The error occurs during the normalization. It seems that the prototype patching is not working correctly. The this in this function has not the right prototype chain. So the call to this.has fails here.

I should also add that I am using plugin-typescript but that should not be a problem I guess.

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

I cloned this repo and tried the test and get the same error. Which systemjs version are you using?
I am using SystemJS v0.19.40.

I inlined the System.has function and then the hot reload works. In the end reloader.loadCache.clear(); throws an error because the loadCacheis undefined.

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

I found a fix and will make a PR. #7

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Thanks! I also forgot, when using _System you need to _System.normalize(System, "someModule")

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Do your circular reps work now.

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

Now I get this error when the modulename is normalized:

TypeError: CreateListFromArrayLike called on non-object
    at eval (http://localhost:3000/jspm_packages/github/alexisvincent/systemjs-hmr@master/dist/next.js:200:50)

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Sorry. Pushing a fix

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

Great! Now it works!

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Awesome :) Thoughts on the new state hydration/ unload api?

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

I like it! I am not sure about the @hot module name but I can't come up with something better. :)

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

If you come up with a better name let me know :) Do you have an opinion on the exporting state vs private persistent object state hydration techniques?

from systemjs-hmr.

frederikschubert avatar frederikschubert commented on May 27, 2024

I like the current API with the exported state. This gives the developer the freedom to implement the state re-hydration any way he/she likes.

from systemjs-hmr.

alexisvincent avatar alexisvincent commented on May 27, 2024

Cool thanks for the input.

from systemjs-hmr.

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.