Closed Qard closed 9 years ago
@Qard When a second module is loaded, it stores a reference to the previous require
. Thus requiring a bundle id or name will follow this stored chain back up until the module is found, or an Error(Cannot find module "moduleName")
is thrown.
Bundles created at one time with factor-bundle
should contain unique module indexes. If they are not, that's a bug. Exposed module names should also be preserved, again file a bug if they are not.
Finally, specifically for debug
, you can also enable and disable specific log names by setting localStorage.debug = key
, which works even if you don't know the module index. (Different names can be given as space or comma separated names, and can contain "*" wildcards)
This is not so much an issue as a minor nit that'd be nice to find a way around.
When using factor-bundle and loading the common file and page files in your html, the common require gets overridden by the page require. When using one big bundle you can inspect the code and use
require(moduleIndex)
to get at the internals of the bundle for debugging. However, factor-bundle splits them out and only the ones that made it into page bundle are accessible in this way.I'm not sure if there's an easy fix for this, or if it's even all that important. I came across this when using debug in my bundle and wanting to get at it in the console to turn on logs for some things with
debug.enable('key')
, but it was factored into my common bundle and thus inaccessible.