alexisvincent / systemjs-hot-reloader

reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
MIT License
228 stars 36 forks source link

module is already loaded error #142

Closed TobyEalden closed 7 years ago

TobyEalden commented 7 years ago

I'm having problems getting this to work - I've followed the instructions and have chokidar-socket-emitter running, but when any file is modified I always get the following in the console:

systemjs-hmr.js:12430
Error: This module is already loaded.
  Evaluating http://localhost:8080/client/main.js
  Loading http://localhost:8080/client/main.js
    at App.loadModule (app.js:72)
    at Object.execute (main.js:30)
    at j (register-loader.js:673)
    at E (register-loader.js:602)
    at O (register-loader.js:535)
    at register-loader.js:132
    at tryCatcher (bluebird.js:5253)

using version 1.1.0 with jspm "0.17.0-beta.41"

alexisvincent commented 7 years ago

Are you able to provide me a small reproducible project. That I can test with? I suspect it has to do with your application, not the loader :)

Otherwise perhaps you can describe your application setup?

TobyEalden commented 7 years ago

I suspect it has to do with your application, not the loader :)

I'm sure you're right!

I'll try and create a smaller example to reproduce it.

One thing I'm not clear about is whereabouts in the jspm.config.js the @hot tag should be - jspm appears to have added several "map" properties in various places. In desperation my approach has been to add it everywhere (see attached).

jspm.config.js.txt

TobyEalden commented 7 years ago

Solved - for future reference, the app is based on the mantra spec and the issue is caused by https://github.com/mantrajs/mantra-core/blob/master/src/app.js#L45.

Fixed by warning instead of throwing if module is already loaded - https://github.com/nqminds/nqm-mantra-core/blob/master/src/app.js#L44

alexisvincent commented 7 years ago

:) Awesome! Sorry for the non reply :/