How many instances of a common dependency exist in memory?

25 views
Skip to first unread message

Clint

unread,
May 19, 2016, 3:54:25 PM5/19/16
to SystemJS
Given the following SystemJS config snippet:

map: {
  "aaa": {
    "lodash": "npm:lod...@4.6.1"
  },
  "bbb": {
    "lodash": "npm:lod...@4.6.1"
  }
}


How many instances of lodash will exist in memory?

Every module gets its own namespace, so initially I thought this meant lodash would be instantiated twice. However, my understanding is that ES6 modules are immutable--which means it would be safe to only have a single instance of lodash...

Can you clarify?

Thanks!

Guy Bedford

unread,
May 25, 2016, 12:10:29 PM5/25/16
to Clint, SystemJS
Yes, there is a single module registry namespace which allows every module to execute only once and be shared.

--
You received this message because you are subscribed to the Google Groups "SystemJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to systemjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages