These are chat archives for systemjs/systemjs

27th
Dec 2015
λex Vincent
@alexisvincent
Dec 27 2015 11:01
im about to write a hot module replacement system for system js with react component support. Does anyone know of an alternative?
That already exists
Lex Robinson
@Lexicality
Dec 27 2015 11:53
@PWKad You want to load different modules for testing or karma isn't finding your packages?
Peter Uithoven
@peteruithoven
Dec 27 2015 14:33
λex Vincent
@alexisvincent
Dec 27 2015 14:44
ill check it out thanks. Not sure if it has react hotloading support
Peter Uithoven
@peteruithoven
Dec 27 2015 14:45
It doesn't, but it could be done by handing the __reload in every component
λex Vincent
@alexisvincent
Dec 27 2015 14:46
What exactly does the __reload function do?
Peter Uithoven
@peteruithoven
Dec 27 2015 14:47
It's called in the freshly loaded module. it gets the old module as argument, which means the new module can request the state from the old module and refill itself
λex Vincent
@alexisvincent
Dec 27 2015 14:49
I see. So reload is a function added to all modules. Is there a way to globally run a function?
i want to get it to run with https://github.com/gaearon/react-proxy
Peter Uithoven
@peteruithoven
Dec 27 2015 14:50
I mostly created it so I could restore state of my redux store, this would only require one __reload function
λex Vincent
@alexisvincent
Dec 27 2015 14:51
However react components are a bit weird… Because they have internal state. And its in a few places...
Peter Uithoven
@peteruithoven
Dec 27 2015 14:53
You could try extending the logic where __reload is called, making sure those cases are handled. Would be great if it could extend the hot reloader, but I'm not sure how
λex Vincent
@alexisvincent
Dec 27 2015 14:54
Ill have a look. The logic for your reloader is pretty simple right?
Bnaya Peretz
@Bnaya
Dec 27 2015 14:58

paths declaration cause builder to strips file extension:
I have the following config:

  paths: {
    "github:*": "lib/github/*",
    "npm:*": "lib/npm/*",
    "Photomania/*": "js/Photomania/*"
  },

  packages: {
    "js/Photomania": {
      "defaultExtension": false,
      "defaultJSExtensions": false
    }
  },

My main file is: '/Users/bnaya/dev/photomania/mobile2/src/js/Photomania/Mobile/main.js'
and he is specified with the extension.
When building i'm getting the error:
jspm build error ENOENT: no such file or directory, open '/Users/bnaya/dev/photomania/mobile2/src/js/Photomania/Mobile/main'
The .js extension got stripped.

If i remove the the

"Photomania/*": "js/Photomania/*"

From the paths config it works.
But i need that mapping

λex Vincent
@alexisvincent
Dec 27 2015 15:14
is there support for babel 6?
Peter Uithoven
@peteruithoven
Dec 27 2015 15:15
Not sure, I've never tried babel 6 in combination with systemjs
λex Vincent
@alexisvincent
Dec 27 2015 15:16
ok. It seems to be unsupported.. Which is a pity.
Peter Uithoven
@peteruithoven
Dec 27 2015 15:17
have you tried babel 6 with systemjs?
λex Vincent
@alexisvincent
Dec 27 2015 16:44
Not yet. Was just what i picked up from the babel-plugin repository
Im getting an issue with sass. Its complains:
DataCloneError: Failed to execute 'postMessage' on 'Worker': An object could not be cloned.
λex Vincent
@alexisvincent
Dec 27 2015 17:40
@peteruithoven trying your hmr now. What path does it require?
Peter Uithoven
@peteruithoven
Dec 27 2015 17:41
@alexisvincent not sure what path you referring to
λex Vincent
@alexisvincent
Dec 27 2015 18:14
@peteruithoven sorry
chokidarEvEmitter({port: 8090, path: '..'})
my __reload function is not executing
Peter Uithoven
@peteruithoven
Dec 27 2015 18:19
@alexisvincent I'm afraid I forgot a recent change, that caused only the "root" module's __reload is called: https://github.com/capaj/systemjs-hot-reloader/issues/30#issuecomment-164468779
could that be the cause of your issue?
λex Vincent
@alexisvincent
Dec 27 2015 18:22
oh! yeah. This is a leaf node.. Is there anyway around this?
Peter Uithoven
@peteruithoven
Dec 27 2015 18:23
not that I can think of, I'm afraid the first step would have to be to make sure __reload is called on all reloaded modules again
λex Vincent
@alexisvincent
Dec 27 2015 18:23
ok. So if a leaf node changes the root __reload gets called?
Peter Uithoven
@peteruithoven
Dec 27 2015 18:25
yeah, I think it traces back to the root, deleting all modules that relied (directly or indirecly) on the changed module and only explicitly reloads that module.
λex Vincent
@alexisvincent
Dec 27 2015 18:25
oh I see.
λex Vincent
@alexisvincent
Dec 27 2015 22:27
@peteruithoven awesome :) have everything working. Just need to get scss to autoreload. How would you suggest I proceed?
Peter Uithoven
@peteruithoven
Dec 27 2015 22:32
@alexisvincent sounds awesome, but what execly? Even calling the __reload on all modules and hot reloading react components?
λex Vincent
@alexisvincent
Dec 27 2015 23:15
Scss seems to be a problem… Because the import tree isnt recognosed by systems module loading scheme and as such editing a child .scss file doesnt update the root. Im thinking of compiling server side and then just replacing the root node
not quite. For now it looses dom state. But im ok with that for now. Ass soon as I can get scss working then Ill write a loader that saves react state. I have some people who need to work on the actual application and so scss hot reloading is rather important inorder to switch away from webpack.
@peteruithoven unless you have another suggestion